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