Java 60 MCQS Question paper Online Test Series 5251 July 14, 2026 0% 20 Java 60 MCQS Question paper Online Test Series 5251Java MCQ question Paper Basic To Advanced Select BatchMorningEvening 1 / 60To find length of a String: size(str) str.length() str.count() str.size() 2 / 60Output of System.out.println(5+5+”Java”); Java10 55Java 10Java Error 3 / 60Infinite loop example: for(;;) while(true) 4 / 60for loop repeats until: Condition is false Condition is true 5 / 60Syntax of for loop: for(init; condition; update) for(init; update; condition) All Of the above for(condition; init; update) 6 / 60The modulus operator is: * # / % 7 / 60default case in switch is: Mandatory Optional 8 / 60Single-line comments use: # // <!– –> /* */ 9 / 60Variables store ______. Classes Keywords Operators Data values 10 / 60!(5 == 5) results in: true false 11 / 60Multi-line comments start with: // /** # /* 12 / 60Math.pow(2,4) equals: 6 8 4 16 13 / 60Type of Margin in notepad ? 9 7 8 4 14 / 60System.out.println(“A”+”B”); prints: AB Error A+B A B 15 / 60Every case label must end with: exit; break; stop; ; 16 / 60String class belongs to package: java.lang java.string java.io java.util 17 / 60Correct declaration: int arr[] = {1,2,3}; new array[3]; arr int[] = {1,2,3}; array arr[] = new int; 18 / 60Which keyword defines a class? object class define Class 19 / 60To compare two strings: match() == compare() equals() 20 / 60Syntax of if statement: if:condition if{condition}( ) None if(condition){ } 21 / 60Java is a ______ language. Compiled None Interpreted Both 22 / 60Java is ______ typed. Weakly Dynamically Statically Loosely 23 / 60Which of these is correct syntax? println("Hi"); System.out.println("Hi"); system.out.println("Hi"); echo("Hi"); 24 / 60Static variables are shared by ______. One object only All objects One method None 25 / 60Logical AND is: || & | && 26 / 60Strings are ______ in Java. Mutable Immutable 27 / 60double x = 9.8; int y = (int)x; Valid Invalid 28 / 60To get array length: Alm(544) length(arr) arr.length arr.size() 29 / 60Which loop executes fixed number of times? for do-while while All of the above 30 / 60Which is the assignment operator? := = =^ == 31 / 60Increment operator is: += + inc ++ 32 / 60Converting one data type into another is called: Evaluation Promotion Conversion Typecasting 33 / 60Which requires explicit cast? Widening Narrowing 34 / 60switch works with: float double int, char, String boolean only 35 / 60The extension of Java source files is ______. .class .jar .java .jav 36 / 60Which performs multiplication? mul x × * 37 / 60Java statements end with a ______. Semicolon Colon Period Comma 38 / 60Java was developed by ______. Oracle Microsoft Sun Microsystems Apple 39 / 60Which method prints a line and moves to the next line? print() write() output() println() 40 / 60Identifiers in Java are ______. Case-sensitive Non-sensitive Case-insensitive Numeric 41 / 60Random number function: Math.random() random.Math() Math.rand() rand() 42 / 60Which is not a primitive type? String char float int 43 / 60Default value of boolean is: false true 0 null 44 / 60Which package is required for Scanner? java.lang.* java.util.* java.scanner.* java.io.* 45 / 60What executes when if condition is false? else block if block 46 / 60Boolean type holds: true or false 1 or 0 Yes or No ‘T’ or ‘F’ 47 / 60Which declares an integer variable correctly? var int; int num; integer num; num int; 48 / 60Which is widening conversion? double → int long → short int → double float → byte 49 / 60Comments are used for: Errors Execution Debugging only Documentation 50 / 60Nested if means: Only one if Multiple ifs inside another if 51 / 60What does System.out.print() do? Reads input Prints with newline Prints without newline Stops program 52 / 60(10 > 5) && (2 < 4) returns: false true/false true false/true 53 / 60Who is known as the father of Java? James Gosling Guido van Rossum Dennis Ritchie Bjarne Stroustrup 54 / 60Boolean can store: T/F Yes/No true/false 1/0 55 / 60Default value of an int variable is: undefined null 1 0 56 / 60The entry point of any Java program is the ______ method. init() main() run() start() 57 / 60Math.abs(-8) returns: 8 Error -8 0 58 / 60Math.sqrt(25) returns: 4 Error 5 6 59 / 60Size of double type is: 16 bytes 4 bytes 8 bytes 2 bytes 60 / 60Array index starts from: 2 0 3 1 Your score is 0% Restart Online Test