Professional Documents
Culture Documents
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. showStatusBar()
b. drawStatus()
c. showStatus()
d. drawStatusBar()
Feedback
Question 2
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. The program compiles fine, but it does not run because you cannot use the keyword
this in the constructor.
b. The program has a compilation error because t is defined in both the main() method
and the constructor Test().
c. The program compiles and runs and displays nothing.
The correct answer is: The program compiles and runs and displays test.
Question 3
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. Method methods[] = c.getMethods();
7. for (int i = 0; i < methods.length; i++)
8. System.out.println(methods[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 of ‘java.awt.Dimension’ package.
c. program prints all the methods and data member of ‘java.awt.Dimension’ package.
The correct answer is: Program prints all the methods of ‘java.awt.Dimension’ package.
Question 4
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. |
b. &&
c. !
d. &
Feedback
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Java Design Kit
b. Java Development Kit
c. Java Defination Kit
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will happen if you try to compile and run the following code?
public class Q {
public static void main(String argv[]){
int anar[]=new int[5];
System.out.println(anar[0]);
}
}
Select one:
a. 0
b. null
c. Error: anar is referenced before it is initialized
d. 5
Feedback
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
1. class increment {
2. public static void main(String args[])
3. {
4. int g = 3;
5. System.out.print(++g * 8);
6. }
Select one:
a. 33
b. 32
c. 25
d. 24
Feedback
The correct answer is: 32
Question 8
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
A. true
B. 1
C. false
D. Hello
Feedback
Question 9
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Identify the most correct JDK command to run a Java application in ByteCode.class.
Select one:
a. java ByteCode.class
b. javac ByteCode.java
c. java ByteCode
d. javac ByteCode
Feedback
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. gif file
b. RTF file
c. html file
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. B
b. A
c. AC
d. BC
Feedback
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
1. class increment {
2. public static void main(String args[])
3. {
4. double var1 = 1 + 5;
5. double var2 = var1 / 4;
6. int var3 = 1 + 5;
7. int var4 = var3 / 4;
8. System.out.print(var2 + " " + var4);
9.
10. }
11. }
Select one:
a. 1.5 0
b. 1.5 1
c. 0 1
d. 1 1
Feedback
Question 13
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. run
b. java
c. appletviewer
d. applet
Feedback
Question 14
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. java.rmi
b. java.awt
c. java.applet
d. java.util
Feedback
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. getPriority()
b. prority()
c. setPriority()
d. threadPriority()
Feedback
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. int [] arr = new int[5]
B. int arr[]
arr = new int[5]
C. int arr[] = int [5] new
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The correct answer is: Both Extending the thread class & Implementing Runnable
interface
Question 18
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. Frame
b. GridBagLayout
c. CardLayout
d. BorderLayout
Feedback
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. runThread()
B. stop()
C. run()
D. stopThread()
Feedback
Question 20
Incorrect
Mark 0.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. global
b. transient
c. volatile
Question 21
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. drawRect()
b. drawLine()
c. All of the mentioned (drawLine(), drawPolygon() & drawRect() )
d. drawPolygon()
Feedback
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 1,2 & 3
b. 1,2,3 & 4
c. 1 only
d. 1 & 2
Feedback
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. A web toolkit
b. Application with types
c. Abstract Window toolkit
Question 24
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. String s4 = (String) '\ufeed';
b. String s3 = (String) 'abc';
c. String s2 = 'null';
d. String s1 = null;
Feedback
Question 25
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. public void paint(Graphics g) {
5. g.drawString("A Simple Applet", 20, 20);
6. }
7. }
Select one:
a. 50
b. 100
c. System dependent
d. 20
Feedback
Question 26
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. Compilation fails with an error at line 6
b. Compilation succeed but Runtime Exception
c. run-a
d. run-a run-a
Feedback
Question 27
Not answered
Marked out of 1.00
Flag question
Question text
1. class ternary_operator {
2. public static void main(String args[])
3. {
4. int x = 3;
5. int y = ~ x;
6. int z;
7. z = x > y ? x : y;
8. System.out.print(z);
9. }
10. }
Select one:
a. 1
b. 0
c. 3
d. -4
Feedback
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
A. Type mismatch error
B. Run infinite-times
C. Welcome Welcome
D. Welcome
Feedback
Question 29
Not answered
Marked out of 1.00
Flag question
Question text
1. import java.io.*;
2. class Chararrayinput {
3. public static void main(String[] args) {
4. String obj = "abcdefgh";
5. int length = obj.length();
6. char c[] = new char[length];
7. obj.getChars(0, length, c, 0);
8. CharArrayReader input1 = new CharArrayReader(c);
9. CharArrayReader input2 = new CharArrayReader(c, 1,
4);
10. int i;
11. int j;
12. try {
13. while((i = input1.read()) == (j = input2.read())) {
14. System.out.print((char)i);
15. }
16. }
17. catch (IOException e) {
18. e.printStackTrace();
19. }
20. }
21. }
Select one:
a. abcde
b. None of the mentioned
c. abcd
d. abc
Feedback
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. NullPointerException
b. ThreadException
c. InterruptedExceptoin
d. IOException
Feedback
Question 31
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. NORMAL_PRIORITY
b. DEFAULAT_PRIORITY
c. NORM_PRIORITY
d. DEF_PRIORITY
Feedback
Question 32
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. four
b. two
c. three
d. one
Feedback
Question 33
Not answered
Marked out of 1.00
Flag question
Question text
Which of the following is a method having same name as that of its class?
Select one:
A. class
B. constructor
C. finalize
D. delete
Feedback
Question 34
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. update()
b. draw()
c. show()
d. paint()
Feedback
Flag question
Question text
Select one:
A. switch statement is more efficient than a set of nested ifs.
B. switch statement can only test for equality, whereas if statement can evaluate any
type of boolean expression.
C. two case constants in the same switch can have identical values.
The correct answer is: two case constants in the same switch can have identical values.
Question 36
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. Thread[main,5,main]
B. Thread[main,5]
C. Thread[main,0]
D. Thread[5,main]
Feedback
The correct answer is: Thread[main,5,main]
Question 37
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. =
B. = =
C. +=
D. %=
Feedback
Question 38
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. void drawstring(String s,int x,int y)
b. void drawstring(String x,int x)
c. void drawstring(String s)
Question 39
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. Width
b. Name
c. Height
d. Code
Feedback
Question 40
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. 3 , 1
B. 1 , 3
C. 1 , 0
D. 1 , 1
Feedback
The correct answer is: 1 , 1
Question 41
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. Compilation Error
B. Runtime Error
C. 2
D. 0
Feedback
Question 42
Not answered
Marked out of 1.00
Flag question
Question text
An expression involving byte, int, and literal numbers is promoted to which of these?
Select one:
A. long
B. float
C. byte
D. int
Feedback
Question 43
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. java.awt.image
b. java.applet
c. java.io
d. java.awt
Feedback
Question 44
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. The code will compile correctly but will give a runtime exception
B. The code will compile correctly and will print “In first main()” (without quotes) when it
is run
C. The code will not compile and will give “Duplicate main() method declaration” error
D. The code will compile correctly and will print “In first main()” (without quotes) when it
is run
Feedback
The correct answer is: The code will compile correctly and will print “In first main()”
(without quotes) when it is run
Question 45
Not answered
Marked out of 1.00
Flag question
Question text
What will happen when you compile and run the following code?
public class MyClass{
static int i;
public static void main(String argv[]){
System.out.println(i);
}
}
Select one:
a. 0
b. null
c. 1
d. Error Variable i may not have been initialized
Feedback
The correct answer is: Error Variable i may not have been initialized
Question 46
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
A. JDK
B. JDB
C. JVM
D. JRE
Feedback
Question 47
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. obj = new Box();
b. Box obj = new Box();
c. new Box obj;
Flag question
Question text
Which of these operators can be used to get run time information about an object?
Select one:
a. Info
b. getinfoof
c. getInfo
d. instanceof
Feedback
Question 49
Not answered
Marked out of 1.00
Flag question
Question text
1. class equality {
2. int x;
3. int y;
4. boolean isequal(){
5. return(x == y);
6. }
7. }
8. class Output {
9. public static void main(String args[])
10. {
11. equality obj = new equality();
12. obj.x = 5;
13. obj.y = 5;
14. System.out.println(obj.isequal());
15. }
16. }
Select one:
a. false
b. 1
c. 0
d. true
Feedback
Question 50
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. oak
b. C Language
c. J language
d. oct
Feedback