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
Questions
All classes in Java directly or indirectly extends ……………. class.
- object
- system
- string
- integer
Java technology consists of
- a Programming Language and a Development Environment
- an Application Environment and a Deployment Environment
- Both (1) and (2)
- None of these
The static block even exectuted without main method in application program.
- True
- False
With the help of …………, a programmer can execute C, C++ or assembly language with the help of operating system directly.
- polymorphism
- inheritance
- code reusability
- JNI (Java Native Interface)
The default value of char (Primitive Type) is
-
u0000 - 0
- null
- 0.0f
What is the output of the following program?
public static void main(String arg[])
- Compile time error
- Run time error
- Helloworld
- Garbage value
…………………… class is the base class of all exception and errors.
- RuntimeException
- Exception
- Errors
- ArithmeticException
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);
}
}
}
- 012345
- Compile time error
- Code will not produce output
- It will show error in Object o=i; and in for(int i3:i2)
JIT stands for
- Java In Time Compiler
- Just In Time Complier
- Java Inhertited Time
- Java Interrupt Time
The size of an int is
- 16 bit
- 32bit
- 64bit
- 8bit
Does a child class inherit superclass constructor?
- Yes
- No
In which package of java scanner class exists?
- import java.lang.*;
- import java.io.*;
- import java.util.*;
- import java.awt.*;
In JAVA, the default layout of a frame is
- grid layout
- flow layout
- card layout
- border layout
For formatted output of string class, we use
- %c
- %d
- %f
- %s
A manager class extends employee class. To invoke the constructor of parent class, user has to invoke …………. method.
- employee.super();
- super();
- manager.super();
- no method will require
Variables labeled …………….. are created when class is loaded and continue to exist for as long as the class is loaded.
- final
- static
- both (1) and (2)
- none of the above
Is JVM (Java Virtual Machine) platform dependent?
- Yes
- No
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);
}
}
- 16
- 256
- 32
- 128
Which method provides random value in java?
- Math.random();
- getRandom();
- setRandom
- random();
Who performs garbage collection in java?
- Java Virtual Machine
- Operating System
- User
- Java Development Environment
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);
}
}
- Compile error
- 10
- Run time error
- Zero
In Java, TCP/IP is of
- 8 bit
- 16 bit
- 32 bit
- 64 bit
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);
}
}
- Run time error
- Compile time error
- 12345
- hello
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);
}
}
- Run time error
- Compile time error
- C=3
- Garbage value
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);
}
}
- Compile time error
- Run time error
- 99.000000000000
- 99