Which of the following is the correct syntax for defining a class in Java?
class MyClass()class MyClass {}MyClass class {}class = MyClass {}Answer: b) class MyClass {}
Which of the following keywords is used to prevent a method from being overridden in Java?
finalstaticabstractprivateAnswer: a) final
What is the default value of a local variable in Java?
null0Answer: d) It does not have a default value
Which of the following is true about constructors in Java?
Answer: b) Constructors are not inherited.
Which of the following is used to implement multiple inheritance in Java?
Answer: a) Interface
Which of the following is used to handle exceptions in Java?
catchthrowfinallyAnswer: d) All of the above
In Java, which method is used to start a thread?
init()start()run()begin()Answer: b) start()
What is the size of an int variable in Java?
Answer: b) 32-bit
Which of the following is the superclass of all classes in Java?
ObjectClassSystemThreadAnswer: a) Object
Which of the following is the correct way to declare an array in Java?
int[] arr = new int[5];int arr[5];array int[] arr = new array[5];array arr = new array[5];Answer: a) int[] arr = new int[5];
Which method is used to read a character from the keyboard in Java?
readLine()read()getchar()nextChar()Answer: b) read()
In Java, which of the following is the correct way to create a new thread?
Thread t = new Thread();Thread t = new Thread(Runnable);Thread t = new Runnable();Answer: d) Both a and b
What will be the output of the following Java code snippet?
int x = 10;
int y = 20;
System.out.println(x + y);
Answer: b) 30
What is the correct way to handle a file operation exception in Java?
try-catch blockthrows declarationtry-throw blockAnswer: d) Both a and b
Which of the following is NOT a feature of Java's AWT (Abstract Window Toolkit)?
Answer: b) It is platform-independent.
Note/Caution: studentsbizz.com does not promise a job or an interview in exchange for money. Fraudsters may ask you to pay under the pretext of a registration fee or refundable fee, but please be aware that legitimate employers will not require such payments.