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