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