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