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