Mock Exam 3
Mock Exam 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. short
b. array
c. int
d. double
Feedback
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Boolean
b. Numeric
c. Characters
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A class Car and its subclass Yugo both have a method run() which was written by the
programmer as part of the class definition. If junker refers to an object of type Yugo,
what will the following code do?
junker.show();
Select one:
a. The show() method defined in Car will be called.
b. Overloading will be used to pick which run() is called.
c. The compiler will complain that run() has been defined twice.
The correct answer is: The show() method defined in Yugo will be called.
Question 4
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What is the process of defining more than one method in a class differentiated by
method signature?
Select one:
A. Function overloading
B. Function doubling
C. None of the mentioned
D. Function overriding
Feedback
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. There can be only one main() method in a program.
b. main() method must be made public.
c. Applets do not require a main() method at all.
The correct answer is: Every class must contain a main() method.
Question 6
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
1. class main_class {
2. public static void main(String args[])
3. {
4. int x = 9;
5. if (x == 9) {
6. int x = 8;
7. System.out.println(x);
8. }
9. }
10. }
Select one:
a. Compilation error
b. 9
c. 8
d. Runtime error
Feedback
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. Abstract class can be initiated by new operator
B. Abstract class defines only the structure of the class not its implementation
C. Every class containing abstract method must be declared abstract
The correct answer is: Abstract class can be initiated by new operator
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. B A
B. A B
C. Runtime Error
D. Compilation Error
Feedback
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Applets shoud be run under a Java-compatible browser
b. Applets do not need a main() method
c. User I/O is accomplished with Java's stream I/O classes
The correct answer is: User I/O is accomplished with Java's stream I/O classes
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the return type of a method that does not returns any value?
Select one:
A. double
B. int
C. float
D. void
Feedback
Question 11
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. String associated with obj1
B. false
C. Compilation Error
D. true
Feedback
Question 12
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. An event is an object that describes a state change in processing.
B. An event is a class used for defining object, to create events.
C. An event is an object that describes any change by the user and system.
The correct answer is: An event is an object that describes a state change in a source.
Question 13
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. Object class
b. ArrayList class
c. Abstract class
d. String class
Feedback
Question 14
Not answered
Marked out of 1.00
Flag question
Question text
Which of the following option leads to the portability and security of Java?
Select one:
A. The applet makes the Java code secure and portable
B. Bytecode is executed by JVM
C. Use of exception handling
Question 15
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. alloc
B. malloc
C. new
D. new malloc
Feedback
Question 16
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. Abstract
B. abstract class
C. abstract
D. Abst
Feedback
Question 17
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. II
b. I
c. IV
d. III
Feedback
Question 18
Not answered
Marked out of 1.00
Flag question
Question text
Which of the following loops will execute the body of loop even when condition
controlling the loop is initially false?
Select one:
a. while
b. do-while
c. None
d. for
Feedback
Question 19
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. compile Test.java
b. java Test
c. javac Test.java
d. javac Test
Feedback
Question 20
Not answered
Marked out of 1.00
Flag question
Question text
What is the value stored in the object obj Ref to the line of code below?
box obj;
Select one:
a. NULL
b. Garbage
c. Memory address of allocated memory of an object.
Question 21
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
A. 10, 30, 20
B. 10, 5, 0, 20, 0
C. 60, 5, 0, 20
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. true true
b. false false
c. true false
d. false true
Feedback
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. new
B. give
C. Amalloc
D. alloc
Feedback
The correct answer is: new
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. -128 to 127
B. -32768 to 32767
C. -32768 to 32768
D. -128 to 128
Feedback
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which interface provides the capability to store objects using a key-value pair?
Select one:
a. java.util.Set
b. java.util.Map
c. Java.util.Collection
d. java.util.List
Feedback
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. boolean b2 = ‘false’;
b. boolean b3 = false;
c. boolean b1 = 1;
d. boolean b4 = ‘true’
Feedback
Question 27
Not answered
Marked out of 1.00
Flag question
Question text
If a class inheriting an abstract class does not define all of its function then it will be
known as?
Select one:
A. A simple class
B. Abstract
C. None of the option mentioned
D. Static class
Feedback
Question 28
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
which of the following data types comes under floating data types ?
Select one:
a. float
b. byte
c. int
d. long
Feedback
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. object
B. class
C. method
D. variable
Feedback
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 0
b. -1
c. -101
d. -10
Feedback
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
1. class Relational_operator {
2. public static void main(String args[])
3. {
4. int var1 = 5;
5. int var2 = 6;
6. System.out.print(var1 > var2);
7. }
8. }
Select one:
a. 0
b. 1
c. true
d. false
Feedback
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
When a class extends the Thread class ,it should override…… method of Thread class to
start that thread.
Select one:
a. go()
b. start()
c. init()
d. run()
Feedback
Question 33
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
A. true and false are numeric values 1 and 0.
B. true and false are numeric values 0 and 1.
C. true is any non zero value and false is 0.
The correct answer is: true and false are non numeric values.
Question 34
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following sequence of method calls take place when an applet begins?
Select one:
a. init(), start(), create()
b. start(), init(), paint()
c. init(), start(), paint()
d. start(), init(), create()
Feedback
Question 35
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
A. protected
B. constant
C. static
D. final
Feedback
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of this program?
1. class Output {
2. public static void main(String args[])
3. {
4. int x, y = 1;
5. x = 10;
6. if (x != 10 && x / 0 == 0)
7. System.out.println(y);
8. else
9. System.out.println(++y);
10. }
11. }
Select one:
a. 2
b. Runtime error owing to division by zero in if condition.
c. 1
Question 37
Correct
Mark 1.00 out of 1.00
Flag question
Question text
1. class box {
2. int width;
3. int height;
4. int length;
5. int volume;
6. void volume() {
7. volume = width*height*length;
8. }
9. }
10. class Output {
11. public static void main(String args[])
12. {
13. box obj = new box();
14. obj.height = 1;
15. obj.length = 5;
16. obj.width = 5;
17. obj.volume();
18. System.out.println(obj.volume);
19. }
20. }
Select one:
a. 26
b. 25
c. 1
d. 0
Feedback
Question 38
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of the following is correct syntax for defining a new class Jolt based on the
superclass SoftDrink?
Select one:
a. class Jolt defines SoftDrink
{
//additional definitions go here
}
b. class Jolt implements SoftDrink
{
//additional definitions go here
}
c. class Jolt isa SoftDrink
{
//additional definitions go here
}
Question 39
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. 1 2
B. Runtime Error
C. Compilation Error
D. 2 1
Feedback
Question 40
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. Font(String name)
b. Font(String name,int style)
c. Font(string name,int style,int size)
Question 41
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
A. long
B. double
C. Integer
D. Float
Feedback
Question 42
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. restart()
b. resume()
c. start()
d. run()
Feedback
Question 43
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. start()
b. init()
c. paint()
d. none of these
Feedback
Question 44
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these package is used for all the text related modifications?
Select one:
a. java.text
b. java.awt
c. java.lang.text
d. java.text.mofify
Feedback
Question 45
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. Objects
b. Component
c. Container
d. Label
Feedback
Question 46
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
1. class area {
2. public static void main(String args[])
3. {
4. double r, pi, a;
5. r = 9.8;
6. pi = 3.14;
7. a = pi * r * r;
8. System.out.println(a);
9. }
10. }
Select one:
a. 301.5656
b. 301.56560000
c. 301
d. 301.56
Feedback
Question 47
Not answered
Marked out of 1.00
Flag question
Question text
What is process of defining two or more methods within same class that have same
name but different parameters declaration?
Select one:
A. method overloading
B. None of the mentioned
C. method hiding
D. method overriding
Feedback
Question 48
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. None of these statements are incorrect.
b. Statement I
c. Statement II
d. Statement III
Feedback
Question 49
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of these package is used for handling security related issues in a program?
Select one:
a. java.lang.security
b. java.security
c. java.io.security
d. java.awt.image
Feedback
Question 50
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What is the output of this program?
class Output {
static void main(String args[])
{
int x , y = 1;
x = 10;
if (x != 10 && x / 0 == 0)
System.out.println(y);
else
System.out.println(++y);
}
}
Select one:
a. 2
b. 1
c. Runtime Error
d. Compilation Error
Feedback