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