Juicy multiple choice questions quiz in java.
2 posters
Page 1 of 1
Juicy multiple choice questions quiz in java.
Juicy multiple choice questions quiz in java.
Instruction:
1. The quiz has 20 questions. 19 multiple choice questions and 1 text answer question.
2. Each multiple choice question has only one possible answer.
3. This Quiz Contest is targeted 3rd batch BIT. But anybody can try it.
4. The first three people who send accurate answers at the earliest are rewarded.
5. To send your answers, send an email to anm_brr@live.com in the format 1)i, 2)ii, 3)iii ……. 19)v, 20) (text answer)
6. If you want offline version, click here
Your time starts now!!!!
1. The correct hierarchy of inheritance (in descending order of parenthood) is
a) Java.lang.Throwable
b) Java.lang.Object
c) Java.lang.Exception
d) Java.lang.RuntimeExcpetion
i). a>b>c>d
ii). b>a>d>c
iii). c>d>a>b
iv) b>a>c>d
2. The extension of the binary output created by a Java program is?
i) .java
ii) .class
iii) .exe
iv) .obj
3.
public class ClassA {
public int a;
private int b;
protected final int c = 4;
static final int d = 2;
}
for(int i=0; i<100; i++)
new ClassA();
Hint: Class occupies 8 bytes extra space for storing metadata.
How many bytes of space are allocated in RAM?
i) 2000
ii) 2004
iii) 2008
iv) 2012
4. Which of the statements given bellow is false?
i) Interface variables must be static.
ii) Only public and abstract modifiers are allowed for methods in interfaces.
iii) It is always necessary to create an object implementation for an interface.
iv) You can mark an interface as final.
5. In a java class, what happens when you try to access an object that does not exist?
i) NoSuchObjectFound
ii) NullPointerException
iii) NullReferenceException
iv) NoSuchMethodExcetion
v) NoSuchFieldException
6. Find which one is not true in java
i) Primitives are passed by value and objects are passed by reference.
ii) Classes, methods and variables can be declared as final.
iii) Synchronized methods can be accessed by only one thread concurrently for an instance.
iv) All variables can be declared as transient.
7. while(false){
System.out.println("Hello world");
}Results:
i) IllegalStateException
ii) RuntimeExceptoin
iii) Compilation Error
iv) No error.
8. Which one is not true for java main method?
i) Java main methods are called by JVM
ii) Java application programs must have a main() method.
iii) public static void main(String...args){}
iv) static public void main(String[] args){}
v) main() can not be declared as final.
9. What is true for String and Stringbuffer?
i) String is faster than StringBuffer.
ii) b. String is mutable and StringBuffer is Immutable object
iii) c. Both of them are mutable
iv) d. String is immutable and StringBuffer is mutable
10. Which one is not true for List?
i) ArrayList is good whenever you don’t have thread safety and add/remove/access objects at end and middle of collection.
ii) List allows insert duplicate elements
iii) List allows to insert null object
iv) The initial size for ArrayList is 10 and increase its capacity by double when it reaches maximum(10)
11. Read the code given bellow:
public class ClassA {
int a = 0;
public static void main(String[] args) {
System.out.println(new ClassA().a);
}
} Output:
i) Compiler error
ii) An exception is thrown
iii) The output is 0;
iv) An ambiguous text is printed.
12. When you call System.gc() and Runtime.gc() methods from your program, immediately Garbage collector is called and memory gets free.
i) True
ii) False
13. public static void main(String[] args) {
int x = 5;
try {
x = x * 4;
if (true) {
System.exit(0);
}
} catch (Exception e) {
x = x - 4;
} finally {
x++;
}
System.out.println(x);
} Output of the program:
i) 20
ii) 16
iii) 17
iv) Nothing
v) RuntimeException
14. Which of the following statements is not true?
i) Java is a pure object oriented programming language.
ii) Java is a platform independent language
iii) Java runs on virtual machine
iv) Java comes with the philosophy, write once and run everywhere
15. Output of the following program is
int i = 0;
i = i++;
i = i++;
i = i++;
i = i++;
System.out.println("The value of i is " + i);
i) 4
ii) 5
iii) 0
iv) 3
Output of the following program is
int x = 0;
16. if (x == -x) {
x = x--;
} else {
x++;
}
System.out.println("value of x: " + x);
value of x: ?
i) -1
ii) 1
iii) 0
17. Output of the following program:
public class MyClass {
private int value = 10;
public void setValue(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static void main(String[] args) {
MyClass a, b, c;
a = new MyClass();
b = a;
a.setValue(20);
c = b;
b.setValue(40);
a = c;
c.setValue(30);
System.out.println(a.getValue() + " " + b.getValue() + " "
+ c.getValue());
}
}
Output:
i) 20,40,30
ii) 10,20,40
iii) 30,30,30
iv) 10,10,10
18. StringIndexOutOfBoundsException is -
i) Checked exception
ii) unchecked exception
19. Finally is the block of code that executes always even if exception is occurred.
i) True
ii) False
20. What is bean in java?? Hints : A vegetable rich in vitamins( )
Instruction:
1. The quiz has 20 questions. 19 multiple choice questions and 1 text answer question.
2. Each multiple choice question has only one possible answer.
3. This Quiz Contest is targeted 3rd batch BIT. But anybody can try it.
4. The first three people who send accurate answers at the earliest are rewarded.
5. To send your answers, send an email to anm_brr@live.com in the format 1)i, 2)ii, 3)iii ……. 19)v, 20) (text answer)
6. If you want offline version, click here
Your time starts now!!!!
1. The correct hierarchy of inheritance (in descending order of parenthood) is
a) Java.lang.Throwable
b) Java.lang.Object
c) Java.lang.Exception
d) Java.lang.RuntimeExcpetion
i). a>b>c>d
ii). b>a>d>c
iii). c>d>a>b
iv) b>a>c>d
2. The extension of the binary output created by a Java program is?
i) .java
ii) .class
iii) .exe
iv) .obj
3.
public class ClassA {
public int a;
private int b;
protected final int c = 4;
static final int d = 2;
}
for(int i=0; i<100; i++)
new ClassA();
Hint: Class occupies 8 bytes extra space for storing metadata.
How many bytes of space are allocated in RAM?
i) 2000
ii) 2004
iii) 2008
iv) 2012
4. Which of the statements given bellow is false?
i) Interface variables must be static.
ii) Only public and abstract modifiers are allowed for methods in interfaces.
iii) It is always necessary to create an object implementation for an interface.
iv) You can mark an interface as final.
5. In a java class, what happens when you try to access an object that does not exist?
i) NoSuchObjectFound
ii) NullPointerException
iii) NullReferenceException
iv) NoSuchMethodExcetion
v) NoSuchFieldException
6. Find which one is not true in java
i) Primitives are passed by value and objects are passed by reference.
ii) Classes, methods and variables can be declared as final.
iii) Synchronized methods can be accessed by only one thread concurrently for an instance.
iv) All variables can be declared as transient.
7. while(false){
System.out.println("Hello world");
}Results:
i) IllegalStateException
ii) RuntimeExceptoin
iii) Compilation Error
iv) No error.
8. Which one is not true for java main method?
i) Java main methods are called by JVM
ii) Java application programs must have a main() method.
iii) public static void main(String...args){}
iv) static public void main(String[] args){}
v) main() can not be declared as final.
9. What is true for String and Stringbuffer?
i) String is faster than StringBuffer.
ii) b. String is mutable and StringBuffer is Immutable object
iii) c. Both of them are mutable
iv) d. String is immutable and StringBuffer is mutable
10. Which one is not true for List?
i) ArrayList is good whenever you don’t have thread safety and add/remove/access objects at end and middle of collection.
ii) List allows insert duplicate elements
iii) List allows to insert null object
iv) The initial size for ArrayList is 10 and increase its capacity by double when it reaches maximum(10)
11. Read the code given bellow:
public class ClassA {
int a = 0;
public static void main(String[] args) {
System.out.println(new ClassA().a);
}
} Output:
i) Compiler error
ii) An exception is thrown
iii) The output is 0;
iv) An ambiguous text is printed.
12. When you call System.gc() and Runtime.gc() methods from your program, immediately Garbage collector is called and memory gets free.
i) True
ii) False
13. public static void main(String[] args) {
int x = 5;
try {
x = x * 4;
if (true) {
System.exit(0);
}
} catch (Exception e) {
x = x - 4;
} finally {
x++;
}
System.out.println(x);
} Output of the program:
i) 20
ii) 16
iii) 17
iv) Nothing
v) RuntimeException
14. Which of the following statements is not true?
i) Java is a pure object oriented programming language.
ii) Java is a platform independent language
iii) Java runs on virtual machine
iv) Java comes with the philosophy, write once and run everywhere
15. Output of the following program is
int i = 0;
i = i++;
i = i++;
i = i++;
i = i++;
System.out.println("The value of i is " + i);
i) 4
ii) 5
iii) 0
iv) 3
Output of the following program is
int x = 0;
16. if (x == -x) {
x = x--;
} else {
x++;
}
System.out.println("value of x: " + x);
value of x: ?
i) -1
ii) 1
iii) 0
17. Output of the following program:
public class MyClass {
private int value = 10;
public void setValue(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static void main(String[] args) {
MyClass a, b, c;
a = new MyClass();
b = a;
a.setValue(20);
c = b;
b.setValue(40);
a = c;
c.setValue(30);
System.out.println(a.getValue() + " " + b.getValue() + " "
+ c.getValue());
}
}
Output:
i) 20,40,30
ii) 10,20,40
iii) 30,30,30
iv) 10,10,10
18. StringIndexOutOfBoundsException is -
i) Checked exception
ii) unchecked exception
19. Finally is the block of code that executes always even if exception is occurred.
i) True
ii) False
20. What is bean in java?? Hints : A vegetable rich in vitamins( )
Re: Juicy multiple choice questions quiz in java.
Would you please help me to understand,what is metadata?
BIT0322-Hira- Alpha Release
- Course(s) :
- BIT
Blood Group : O+
Posts : 24
Points : 33
Re: Juicy multiple choice questions quiz in java.
All variables can be declared as transient. What does it mean?
BIT0322-Hira- Alpha Release
- Course(s) :
- BIT
Blood Group : O+
Posts : 24
Points : 33
Re: Juicy multiple choice questions quiz in java.
did you search over internet ?? Try and help yourself. Its a test. I will discuss all these someday. But before, try to find out, think, search over internet, try in IDE.
Similar topics
» Java Tutorial: Using Two Java Reference Keywords, this and super
» Multiple Terminal in One Window
» How to set multiple images on a button?
» Run a single programm using multiple PCs(mpi linux)
» Multiple IM Chatting softwares for mobiles
» Multiple Terminal in One Window
» How to set multiple images on a button?
» Run a single programm using multiple PCs(mpi linux)
» Multiple IM Chatting softwares for mobiles
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Tue Sep 29, 2015 2:45 pm by Sophiawood
» Cisco EHWIC SFP/GE WAN Card
Mon Sep 07, 2015 11:08 am by Sophiawood
» Huawei S1700-28GFR-4P-AC Price
Thu Jun 25, 2015 2:31 pm by Sophiawood
» teach yourself C++ / Herbert Schildt Solutions
Wed Jun 03, 2015 1:52 pm by Abdullah Al Noman
» teach yourself c by herbert schildt pdf
Wed May 13, 2015 11:01 pm by Raquib Ridwan
» ASA 5506X With Firepower ASA5506-K9
Fri Apr 10, 2015 4:31 pm by Sophiawood
» New Trends in Deal Business
Tue Feb 03, 2015 9:38 pm by nersoa
» PoE Power Allocation for WS-C2960S-24PS-L
Wed Nov 05, 2014 11:12 am by Sophiawood
» How to cure back pain
Fri Oct 31, 2014 7:15 pm by Bergen Guildford