Which method is used to make main thread to wait for all child threads
Join ()
Sleep ()
Wait ()
Stop ()
Q.2.
Which of these class is highest in hierarchy in java
java.lang.Exception
java.lang.Error
java.lang.Throwable
java.lang.Object
Q.3.
When overloading a method, the method header ________ .
Must exactly match the header of the method you are overloading.
Must have the same name, but differ in order, number, or type of parameters.
Can differ in name, but must have the same number and order of parameters.
Can be completely different from the method you are overloading, but must have @Override.
Q.4.
What are the legal indexes for the array ar, given the following declaration:int[] ar = {8 }
0, 1, 2, 3
1, 2, 3, 4
2, 4, 6, 8
0, 2, 4, 6
Q.5.
Which of the following are not Java modifiers?
public
private
friend
transient
Q.6.
_____________ are non graphic characters, which are used as commands to direct the cursor while printing.
Escape Sequences
Q.7.
Q) Number of threads in below java program ispublic class ThreadExtended extends Thread { public void run() { System.out.println("\nThread is running now\n"); } public static void main(String[] args) { ThreadExtended threadE = new ThreadExtended(); threadE.start(); }}
0
1
2
3
Q.8.
Class Demo1{public static void main(String args[]){int i[] = new int[10];System.out.println(i[10]);}}
0
Garbage Value
Out-of-bounds exception
Error
Q.9.
Which of the following is an example of a reference variable declaration?
int count;
String name;
float gpa;
char firstInitial;
Q.10.
Which one is NOT the basic element of OOP?
Class
Abstraction
BlueJ
Polymorphism
Q.11.
Find the output for the following.public class IncDec{ public static void main(String s[]) { int a = int b = int c; int d; c = ++b; d = a++; c++; System.out.println("a = " + a); System.out.print("b = " + b); System.out.println("c = " + c); System.out.print("d = " + d); }}
a = 2 b = 3 c = 4 d = 1
a = 2 b = 3 c = 4 d = 1
Program does not compile.
a = 1 b = 2 c = 4 d = 2
Q.12.
Q) What is maximum thread priority in Java
10
12
5
8
Q.13.
How would you declare a variable storing the tax rate?
int taxRate = 5.1;
taxRate = "5.1";
double taxRate = 5.1;
double taxRate = "5.1";
I do hereby declare thee Sir Tax Rate
Q.14.
Inheritance is used when the relationship between two classes is a(n) _______ relationship.
"HAS-A"
"PART-OF-A"
"IS-A"
inverse
Q.15.
What is sometimes also called a lightweight process?
Thread
Process
JVM
Q.16.
Which of these keywords is used to make a class?
class
struct
int
none of the mentioned
Q.17.
Which of these statement is incorrect?
Every class must contain a main() method
Applets do not require a main() method at all
There can be only one main() method in a program
main() method must be made public
Q.18.
Which concept of Java is a way of converting real world objects in terms of class?
Polymorphism
Encapsulation
Abstraction
Inheritance
Q.19.
Class dog implements the animal interface.Which IS a valid declaration?
Dog d = new Animal();
Animal d = new Dog();
Animal d = new Animal();
Q.20.
If a priority of a java thread is 3 then the default priority of its child thread will be
0
1
5
3
Support mcqgeeks.com by disabling your adblocker.
Please disable the adBlock and continue. Thank you.