Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

Question 1

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

The correct answer is: 20

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of this program?


1.      class exception_handling {
2.          publicstaticvoid main(String args[]){
3.              try{
4.                  int a, b;
5.                  b =0;
6.                  a =5/ b;
7.                  System.out.print("A");
8.              }
9.              catch(ArithmeticException e){
10.         System.out.print("B");            
11.            }
12.        }
13.    }

Select one:
a. A
b. B 
c. Runtime Error

d. Compilation Error
Feedback

The correct answer is: B

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

The correct answer is: class

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

The correct answer is: instanceof

Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the full form of ADT ?

Select one:
a. Abstract Development tool
b. Advance Development Tool
c. Abstract Design Tool

d. Abstract Data Type 


Feedback

The correct answer is: Abstract Data Type

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

The correct answer is: void

Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Given the following code fragment:


int A[];
int i = 0;
A = new int A[4];
while (i < 4)
{
A[i] = 10;
i = i + 1;
}
What is the value of A[3]?
 

Select one:
A. 10 
B. Unknown
C. 3

D. 0
Feedback

The correct answer is: 10

Question 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Java does not support ______________.

Select one:
A. Operator overloading
B. Global variable
C. Multiple inheritance

D. All of the option mentioned 


Feedback

The correct answer is: All of the option mentioned

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of the program.


class operators {
public static void main(String args[])
{
int x = 8;
System.out.println(++x * 3 + "," + x);
}
}

Select one:
a. 27,8
b. 24,8
c. 27,9 

d. 24,9
Feedback

The correct answer is: 27,9

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

The correct answer is: volatile

Question 11
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of these functions is called to display the output of an applet?

Select one:
A. PrintApplet()
B. paint() 
C. display()

D. displayApplet()
Feedback

The correct answer is: paint()

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

The correct answer is: instanceof

Question 14
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

AppletViewer tool is available in which of the folder of JDK

Select one:
a. class
b. lib 
c. source

d. bin
Feedback

The correct answer is: bin

Question 15
Incorrect
Mark 0.00 out of 1.00

Flag question
Question text

What notifyAll() method do?

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

D. No modifier is needed


Feedback

The correct answer is: volatile

Question 17
Correct
Mark 1.00 out of 1.00

Flag question

Question text

which of the following is the smallest integer data type ?

Select one:
a. byte 
b. long
c. short

d. int
Feedback

The correct answer is: byte

Question 18
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

What is the length of the application box made by this program?

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

The correct answer is: Compilation Error

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

The correct answer is: charAt()

Question 20
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the range of data type short in Java?

Select one:
A. -32768 to 32767 
B. -2147483648 to 2147483647
C. -128 to 127

D. None of the mentioned


Feedback

The correct answer is: -32768 to 32767

Question 21
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

What will this code print?


int arr[] = new int [5];
System.out.print(arr);

Select one:
A. value stored in arr[0].
B.  0
C. Garbage value
D.  00000 
Feedback

The correct answer is: Garbage value

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

The correct answer is: Bytecode

Question 23
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is NOT an advantage to using inheritance?  

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.

d. Code that is shared between classes needs to be written only once.


Feedback

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

Which of these values can a boolean variable contain?

Select one:
a. short
b. True & False 
c. int

d. 1 & 0
Feedback

The correct answer is: True & False

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

The correct answer is: catch

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

The correct answer is: NULL

Question 27
Correct
Mark 1.00 out of 1.00

Flag question

Question text

________________ is one of the inventors of Java.

Select one:
A. Balagurusamy
B. Bjarne Straustrup
C. James Gosling 

D. Dannis Ritchie
Feedback

The correct answer is: James Gosling

Question 28
Correct
Mark 1.00 out of 1.00

Flag question

Question text

result = 2 + 3 * 5, what is the value of result?

Select one:
a. 17 
b. 14
c. 10

d. 25
Feedback

The correct answer is: 17

Question 29
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

What is the output of following code snippet ?


1. public class NumberSystem{
2.     public static void main(String[] args) {
3.         int val = 0b11010;
4.         System.out.println("Value : " + val);
5.    }
6. }

Select one:
a. 26
b. 28
c. 32 

d. 64
Feedback

The correct answer is: 26

Question 30
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Decrement operator, –, decreases value of variable by what number?

Select one:
A. 1 
B. 4
C. 2

D. 3
Feedback

The correct answer is: 1

Question 31
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

Which of these methods can be used to output a sting in an applet?

Select one:
A. display()
B.  transient()
C. drawString()

D. print() 
Feedback

The correct answer is: drawString()

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?

1.  public class Test extends Thread{


2.        public static void main(String argv[]){
3.              Test t = new Test();
4.              t.run();
5.              t.start();
6.        }
7.        public void run(){
8.              System.out.println("run-test");
9.        }
10.  }

Select one:
a. Compilation fails due to an error on line 4
b. run-test
c. run-test run-test 

d. Compilation fails due to an error on line 7


Feedback

The correct answer is: run-test run-test

Question 33
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of this program?

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

The correct answer is: World


Question 34
Incorrect
Mark 0.00 out of 1.00

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

The correct answer is:  super

Question 35
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Java was first developed in ?

Select one:
a. 1993
b. 1996
c. 1990

d. 1991 
Feedback

The correct answer is: 1991

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

The correct answer is: equals()

Question 37
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of this program?

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. 

d. Program prints all the methods of ‘java.awt.Dimension’ package.


Feedback
The correct answer is: 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

The correct answer is: Boolean

Question 39
Correct
Mark 1.00 out of 1.00

Flag question

Question text

which data type can store 64 bit value ?

Select one:
a. float
b. double 
c. int

d. long
Feedback

The correct answer is: double

Question 40
Incorrect
Mark 0.00 out of 1.00
Flag question

Question text

For interpretation of java program, _________ command is used.

Select one:
a. java
b. javai
c. javap

d. javac 
Feedback

The correct answer is: java

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

The correct answer is: ReflectPermission

Question 42
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 a = 1;
5.              int b = 2;
6.              int c;
7.              int d;
8.              c = ++b;
9.              d = a++;
10.              c++;
11.              b++;
12.              ++a;
13.              System.out.println(a + " " + b + " " + c);
14.          }   

Select one:
a. 3 4 4 
b. 3 2 4
c. 2 3 4

d. 3 2 3
Feedback

The correct answer is: 3 4 4

Question 43
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Modulus operator, %, can be applied to which of these?

Select one:
A. None of the mentioned
B.  Integers
C.  Both Integers and floating – point numbers. 

D. Floating – point numbers


Feedback

The correct answer is:  Both Integers and floating – point numbers.


Question 44
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Java interpreter translates _____________ into machine code.

Select one:
A. Machine Code
B. User code
C. Bytecode (Virtual Machine Code) 

D. Bitcode
Feedback

The correct answer is: Bytecode (Virtual Machine Code)

Question 45
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Default value of Boolean data type in java is _______________.

Select one:
a. true
b. 1

c. false 
Feedback

The correct answer is: false

Question 46
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Decrement operator, - -, decreases value of variable by what number?


Select one:
a. 3
b. 2
c. 1 

d. 0
Feedback

The correct answer is: 1

Question 47
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of these selection statements test only for equality?

Select one:
a. else if
b. if
c. ?:

d. switch 
Feedback

The correct answer is: switch

Question 48
Correct
Mark 1.00 out of 1.00

Flag question

Question text

A method __________ have same name as that of it’s class?

Select one:
a. delete
b. constructor 
c. finalize

d. class
Feedback

The correct answer is: constructor

Question 49
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

Does a subclass inherit both member variables and methods?  

Select one:
a. Yes, but only one or the other are inherited.
b. No, only member variables are inherited.
c. Yes, both are inherited.

d. No, only methods are inherited. 


Feedback

The correct answer is: Yes, both are inherited.

Question 50
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of this program?

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

The correct answer is: 16.46666666666667

You might also like