0

Computer Language (JAVA)

Description: 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
Number of Questions: 25
Created by:
Tags: Java Core Test ABC in Java A to Z in Java Encyclopedia Java Java Programming Java Applets Java Beans Swings Java Swings Programming
Attempted 0/25 Correct 0 Score 0

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

  1. object

  2. system

  3. string

  4. integer


Correct Option: A

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


Correct Option: C

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

  1. True

  2. False


Correct Option: A

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)


Correct Option: D

The default value of char (Primitive Type) is

  1. u0000

  2. 0

  3. null

  4. 0.0f


Correct Option: A

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


Correct Option: C

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

  1. RuntimeException

  2. Exception

  3. Errors

  4. ArithmeticException


Correct Option: B

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)


Correct Option: A

JIT stands for

  1. Java In Time Compiler

  2. Just In Time Complier

  3. Java Inhertited Time

  4. Java Interrupt Time


Correct Option: B

The size of an int is

  1. 16 bit

  2. 32bit

  3. 64bit

  4. 8bit


Correct Option: B

Does a child class inherit superclass constructor?

  1. Yes

  2. No


Correct Option: B

In which package of java scanner class exists?

  1. import java.lang.*;

  2. import java.io.*;

  3. import java.util.*;

  4. import java.awt.*;


Correct Option: C

In JAVA, the default layout of a frame is

  1. grid layout

  2. flow layout

  3. card layout

  4. border layout


Correct Option: D

For formatted output of string class, we use

  1. %c

  2. %d

  3. %f

  4. %s


Correct Option: D

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


Correct Option: B

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


Correct Option: B

Is JVM (Java Virtual Machine) platform dependent?

  1. Yes

  2. No


Correct Option: A

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


Correct Option: B

Which method provides random value in java?

  1. Math.random();

  2. getRandom();

  3. setRandom

  4. random();


Correct Option: A

Who performs garbage collection in java?

  1. Java Virtual Machine

  2. Operating System

  3. User

  4. Java Development Environment


Correct Option: A

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


Correct Option: B

In Java, TCP/IP is of

  1. 8 bit

  2. 16 bit

  3. 32 bit

  4. 64 bit


Correct Option: B

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


Correct Option: C

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


Correct Option: C

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


Correct Option: D
- Hide questions