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