Java MCQ Quiz Description Total Questions −30 00 Max Time − 15:00 Which statement is true about Java? Java is a sequence-dependent programming language Java is a code dependent programming language Java is a platform-dependent programming language Java is a platform-independent programming language What will be the output of the following Java program? import java.net.*; class networking { &nbs www.sanfoundry.com https://www.xyz.com/javamcq dfddeererer xyz.com What will be the error in the following Java code? byte b = 50; b = b * 50; b cannot contain value 50 b cannot contain value 100, limited by its range No error in this code * operator has converted b * 50 into int, which can not be converted to byte without casting Which of these packages contains the exception Stack Overflow in Java? java.io java.system java.lang java.util Which of the following option leads to the portability and security of Java? Bytecode is executed by JVM The applet makes the Java code secure and portable Use of exception handling Dynamic binding between objects Which of these keywords are used for the block to be examined for exceptions? check throw catch try What is the extension of compiled java classes? .txt .js .class .java Which of these keywords is used to define interfaces in Java? intf Intf interface Interface Which environment variable is used to set the java path? MAVEN_Path JavaPATH JAVA JAVA_HOME Which of the following is not a Java features? Dynamic Architecture Neutral Use of pointers Object-oriented Who invented Java Programming? Guido van Rossum James Gosling Dennis Ritchie Bjarne Stroustrup What will be the output of the following Java program? final class A { int i; } &nbs 2 2 3 3 Runtime Error Compilation Error What will be the output of the following Java program? class recursion { int func (int n)&nb 1 120 0 None of the mentioned Which of the following is not an OOPS concept in Java? Polymorphism Inheritance Compilation Encapsulation What is the numerical range of a char data type in Java? 0 to 256 -128 to 127 0 to 65535 0 to 32767 What will be the output of the following Java program? class overload { int x; double 4 6.4 6.4 6 6.4 6.4 6 6 What is Truncation in Java? Floating-point value assigned to a Floating type Floating-point value assigned to an integer type Integer value assigned to floating type Integer value is not assigned to floating type What will be the output of the following Java program? class leftshift_operator { public sta 0 256 0 64 256 0 64 0 Which of these statements is incorrect about Thread? start() method is used to begin execution of the thread run() method is used to begin execution of a thread before start() method in special cases A thread can be formed by implementing Runnable interface only A thread can be formed by a class that extends Thread class Which one of the following is not a Java feature ? Object-oriented Use of pointers Portable Dynamic and Extensible What will be the output of the following Java code snippet? import java.util.*; class Arraylists { [A, D, C] [A, B, C] [A, B, C, D] [A, D, B, C] What will be the output of the following Java code? class newthread extends Thread { Thread t;   truetrue falsefalse true false Which exception is thrown when java is out of memory? MemoryError OutOfMemoryError MemoryOutOfBoundsException MemoryFullException What is not the use of “this” keyword in Java? Referring to the instance variable when a local variable has the same name Passing itself to the method of the same class Passing itself to another method Calling another constructor in constructor chaining What will be the output of the following Java program? import java.net.*; class networking { &nb 127 126 Runtime Error Compilation Error What will be the output of the following Java code? class Output { public static void main(Str 3 0 4 3.0 What will be the output of the following Java program? class variable_scope { public static Compilation error Runtime error 5 6 5 6 5 6 5 What is the extension of java code files? .js .txt .class .java What will be the output of the following Java program? class Output { public static 1 2 3 4 5 1 2 3 4 1 2 1 2 3 Which of these cannot be used for a variable name in Java ? identifier & keyword identifier keyword none of the mentioned Previous Next Total Question16 Wrong Answer13 Right Answer13