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