Professional Documents
Culture Documents
Mock Exam 2
Mock Exam 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the length of the application box made by the following Java program?
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("A Simple Applet", 20, 20);
}
}
Select one:
A. 50
B. 100
C. System dependent
D. 20
Feedback
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. A
b. B
c. Runtime Error
d. Compilation Error
Feedback
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
String is an________.
Select one:
a. class
b. array
c. data type
d. variable
Feedback
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these operators can be used to get run time information about an object?
Select one:
A. Info
B. instanceof
C. getInfo
D. getinfoof
Feedback
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Abstract Development tool
b. Advance Development Tool
c. Abstract Design Tool
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following return type of a method does not returns any value?
Select one:
a. float
b. int
c. double
d. void
Feedback
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. 10
B. Unknown
C. 3
D. 0
Feedback
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. Operator overloading
B. Global variable
C. Multiple inheritance
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 27,8
b. 24,8
c. 27,9
d. 24,9
Feedback
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these modifiers can be used for a variable so that it can be accessed from any
thread or parts of a program?
Select one:
A. No modifier is needed
B. global
C. transient
D. volatile
Feedback
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. PrintApplet()
B. paint()
C. display()
D. displayApplet()
Feedback
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which operator is used to invert all the digits in binary representation of a number?
Select one:
a. <<<
b. ^
c. >>>
d. ~
Feedback
The correct answer is: ~
Question 13
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of these operators can be used to get run time information about an object?
Select one:
A. getInfo
B. getinfoof
C. Info
D. instanceof
Feedback
Question 14
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. class
b. lib
c. source
d. bin
Feedback
Question 15
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. Wakes up all threads that are waiting on this object's monitor
b. Wakes up one threads that are waiting on this object's monitor
c. None of the mentioned
d. Wakes up all threads that are not waiting on this object's monitor
Feedback
The correct answer is: Wakes up all threads that are waiting on this object's monitor
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these modifiers can be used for a variable so that it can be accessed from any
thread or parts of a program?
Select one:
A. volatile
B. global
C. transient
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. byte
b. long
c. short
d. int
Feedback
Question 18
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
1. import java.awt.*;
2. import java.applet.*;
3. public class myapplet extends Applet {
4. Graphic g;
5. g.drawString("A Simple Applet",20,20);
6. }
Select one:
a. Compilation Error
b. Runtime Error
c. 20
d. Default value
Feedback
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these method of String class is used to obtain character at specified index?
Select one:
a. charAt()
b. char()
c. charectat()
d. chart()
Feedback
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. -32768 to 32767
B. -2147483648 to 2147483647
C. -128 to 127
Question 21
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
A. value stored in arr[0].
B. 0
C. Garbage value
D. 00000
Feedback
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is generated when the source code is successfully compiled?
Select one:
a. Bytecode
b. Output
c. None
d. Error
Feedback
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Similar classes can be made to behave consistently.
b. One big superclass can be used instead of many little classes.
c. Enhancements to a base class will automatically be applied to derived classes.
The correct answer is: One big superclass can be used instead of many little classes.
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. short
b. True & False
c. int
d. 1 & 0
Feedback
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Identify the correct keyword that must be used to handle the exception thrown by try
block in some rational manner?
Select one:
a. finally
b. catch
c. try
d. throw
Feedback
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the stored in the object obj in following lines of code?box obj;
Select one:
A. Any arbitrary pointer
B. Memory address of allocated memory of object.
C. Garbage
D. NULL
Feedback
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. Balagurusamy
B. Bjarne Straustrup
C. James Gosling
D. Dannis Ritchie
Feedback
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 17
b. 14
c. 10
d. 25
Feedback
Question 29
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. 26
b. 28
c. 32
d. 64
Feedback
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. 1
B. 4
C. 2
D. 3
Feedback
Question 31
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
A. display()
B. transient()
C. drawString()
D. print()
Feedback
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will happen when you attempt to compile and run the following code?
Select one:
a. Compilation fails due to an error on line 4
b. run-test
c. run-test run-test
Question 33
Correct
Mark 1.00 out of 1.00
Flag question
Question text
1. class exception_handling {
2. public static void main(String args[]) {
3. try {
4. System.out.print("Hello" + " " + 1 / 0);
5. }
6. catch(ArithmeticException e) {
7. System.out.print("World");
8. }
9. }
10. }
Select one:
a. World
b. HelloWorld
c. Hello World
d. Hello
Feedback
Flag question
Question text
Which of these keywords is used to refer to member of base class from a sub class?
Select one:
A. super
B. None of the mentioned
C. this
D. upper
Feedback
Question 35
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 1993
b. 1996
c. 1990
d. 1991
Feedback
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of these method of String class can be used to test to strings for equality?
Select one:
a. isequals()
b. equal()
c. equals()
d. isequal()
Feedback
Question 37
Correct
Mark 1.00 out of 1.00
Flag question
Question text
1. import java.lang.reflect.*;
2. class Additional_packages {
3. public static void main(String args[]) {
4. try {
5. Class c = Class.forName("java.awt.Dimension");
6. Field fields[] = c.getFields();
7. for (int i = 0; i < fields.length; i++)
8. System.out.println(fields[i]);
9. }
10. catch (Exception e){
11. System.out.print("Exception");
12. }
13. }
14. }
Select one:
a. Program prints all the constructors of ‘java.awt.Dimension’ package.
b. program prints all the methods and data member of ‘java.awt.Dimension’ package.
c. Program prints all the data members of ‘java.awt.Dimension’ package.
Question 38
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Identify the correct returned data type Value by these relational Operators >, <,>=,<=
and ==.
Select one:
a. Boolean
b. Floating - point numbers
c. short
d. Integers
Feedback
Question 39
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. float
b. double
c. int
d. long
Feedback
Question 40
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. java
b. javai
c. javap
d. javac
Feedback
Question 41
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of these class allows us to get real time data about private and protected member
of a class?
Select one:
a. GetInformation
b. java.io
c. ReflectPermission
d. MembersPermission
Feedback
Question 42
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 3 4 4
b. 3 2 4
c. 2 3 4
d. 3 2 3
Feedback
Question 43
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. None of the mentioned
B. Integers
C. Both Integers and floating – point numbers.
Flag question
Question text
Select one:
A. Machine Code
B. User code
C. Bytecode (Virtual Machine Code)
D. Bitcode
Feedback
Question 45
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. true
b. 1
c. false
Feedback
Question 46
Correct
Mark 1.00 out of 1.00
Flag question
Question text
d. 0
Feedback
Question 47
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. else if
b. if
c. ?:
d. switch
Feedback
Question 48
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. delete
b. constructor
c. finalize
d. class
Feedback
Question 49
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. Yes, but only one or the other are inherited.
b. No, only member variables are inherited.
c. Yes, both are inherited.
Question 50
Correct
Mark 1.00 out of 1.00
Flag question
Question text
1. class average {
2. public static void main(String args[])
3. {
4. double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
5. double result;
6. result = 0;
7. for (int i = 0; i < 6; ++i)
8. result = result + num[i];
9. System.out.print(result/6);
10.
11. }
12. }
Select one:
a. 16.34
b. 16.46666666666667
c. 16.46666666666666
d. 16.566666644
Feedback