Computer Language (JAVA)

Get complete study material for Java Core test ABC in Java, A to Z in Java, Encyclopedia Java, Java Programming, Java Applets, Java Beans, Swings, Java Swings

25 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

All classes in Java directly or indirectly extends ……………. class.

  1. object
  2. system
  3. string
  4. integer
Question 2 Multiple Choice (Single Answer)

Java technology consists of

  1. a Programming Language and a Development Environment
  2. an Application Environment and a Deployment Environment
  3. Both (1) and (2)
  4. None of these
Question 3 Multiple Choice (Single Answer)

The static block even exectuted without main method in application program.

  1. True
  2. False
Question 4 Multiple Choice (Single Answer)

With the help of …………, a programmer can execute C, C++ or assembly language with the help of operating system directly.

  1. polymorphism
  2. inheritance
  3. code reusability
  4. JNI (Java Native Interface)
Question 5 Multiple Choice (Single Answer)

The default value of char (Primitive Type) is

  1. u0000
  2. 0
  3. null
  4. 0.0f
Question 6 Multiple Choice (Single Answer)

What is the output of the following program?

public class Demo

{
                       public static void main(String arg[])
{
System.out.println(“Helloworld”);
}
}
  1. Compile time error
  2. Run time error
  3. Helloworld
  4. Garbage value
Question 7 Multiple Choice (Single Answer)

…………………… class is the base class of all exception and errors.

  1. RuntimeException
  2. Exception
  3. Errors
  4. ArithmeticException
Question 8 Multiple Choice (Single Answer)

What will be the output of the following code? import java.lang.*;
public class One
{
public static void main(String arg[])
{
int i[]={0,1,2,3,4,5};
Object o=i;
int i2[]=(int[])o;
for(int i3:i2)
{
System.out.print(i3);
}
}
}

  1. 012345
  2. Compile time error
  3. Code will not produce output
  4. It will show error in Object o=i; and in for(int i3:i2)
Question 9 Multiple Choice (Single Answer)

JIT stands for

  1. Java In Time Compiler
  2. Just In Time Complier
  3. Java Inhertited Time
  4. Java Interrupt Time
Question 10 Multiple Choice (Single Answer)

The size of an int is

  1. 16 bit
  2. 32bit
  3. 64bit
  4. 8bit
Question 11 Multiple Choice (Single Answer)

Does a child class inherit superclass constructor?

  1. Yes
  2. No
Question 12 Multiple Choice (Single Answer)

In which package of java scanner class exists?

  1. import java.lang.*;
  2. import java.io.*;
  3. import java.util.*;
  4. import java.awt.*;
Question 13 Multiple Choice (Single Answer)

In JAVA, the default layout of a frame is

  1. grid layout
  2. flow layout
  3. card layout
  4. border layout
Question 14 Multiple Choice (Single Answer)

For formatted output of string class, we use

  1. %c
  2. %d
  3. %f
  4. %s
Question 15 Multiple Choice (Single Answer)

A manager class extends employee class. To invoke the constructor of parent class, user has to invoke …………. method.

  1. employee.super();
  2. super();
  3. manager.super();
  4. no method will require
Question 16 Multiple Choice (Single Answer)

Variables labeled …………….. are created when class is loaded and continue to exist for as long as the class is loaded.

  1. final
  2. static
  3. both (1) and (2)
  4. none of the above
Question 17 Multiple Choice (Single Answer)

Is JVM (Java Virtual Machine) platform dependent?

  1. Yes
  2. No
Question 18 Multiple Choice (Single Answer)

What will be the output of the following code?
class Shift
{
public static void main(String arg[])
{
int a=64,b;
b=a<<2;
System.out.println(b);
}
}

  1. 16
  2. 256
  3. 32
  4. 128
Question 19 Multiple Choice (Single Answer)

Which method provides random value in java?

  1. Math.random();
  2. getRandom();
  3. setRandom
  4. random();
Question 20 Multiple Choice (Single Answer)

Who performs garbage collection in java?

  1. Java Virtual Machine
  2. Operating System
  3. User
  4. Java Development Environment
Question 21 Multiple Choice (Single Answer)

What will be the output of the following code?
import java.util.*;
public class Hello {
public static void main(String arg[])
{
ArrayList<Integer> list= new ArrayList<Integer>();
list.add(10);
int total=list.get(0);
System.out.println(total);
}
}

  1. Compile error
  2. 10
  3. Run time error
  4. Zero
Question 22 Multiple Choice (Single Answer)

In Java, TCP/IP is of

  1. 8 bit
  2. 16 bit
  3. 32 bit
  4. 64 bit
Question 23 Multiple Choice (Single Answer)

What will be the output of the following code? class Data
{
public static void main(String arg[])
{
int i=12345;
String str=”hello”;
str=String.valueOf(i);
System.out.println(str);
}
}

  1. Run time error
  2. Compile time error
  3. 12345
  4. hello
Question 24 Multiple Choice (Single Answer)

What will be the output of the following code?public class Short
{
public static void main(String[] args)
{
int a,b,c;
a=1;
b=2;
c=a+b;
System.out.println("C="+c);
}
}

  1. Run time error
  2. Compile time error
  3. C=3
  4. Garbage value
Question 25 Multiple Choice (Single Answer)

What will be output of the following code? public class Two
{
public static void main(String arg[])
{
long bvalue=99L;
int squased = (int) bvalue;
System.out.println(squased);
}
}

  1. Compile time error
  2. Run time error
  3. 99.000000000000
  4. 99