You are on page 1of 15

1,1 

Question # 1 / Revisit Choose the best option

m
____________ directly Inherits the Object "public boolean equals(Object obj)" method and tring
does not override it.

I Question # 2
(4
Revisit m
Choose the best option
S

Which of the following for loop declarations does not meet the requirements? 0 for ( int i = 99; i >= 0; i / 2)

0 for ( int i = 7; i <= 77; i += 7 )


0 for ( int i = 20; i >= 2; - -I )
0 for ( int i = 2; i <= 20; = 2* )

I Question # 3
In order to prevent a collision, which of the following is not a most effective technique?
Revisit Choose the best option

m Make the hash function


appear random
m Use the chaining method

1111
m Use uniform hashing
m Increasing hash tabl e
size

1
What will be the output for given statement? 0 510391

1
System.out.println( - 5" +10 - + '3" + '9" + 1);
Revisit Choose the best option
Question # 4
0 28

0 51391

0 271
I Question # Choose the best

The number of threads in the Java programme shown below is: m


public class ThreadExtended extends Thread
m
lir

public void run() \:


( System.out.printIn(\nThread is running now\n"); )
m
public static void main(String[] args)
{ ThreadExtended threadE = new ThreadExtended();

0 6 of

Choose the best

When do Java exceptions occur in the course of a program's m Ru


n Time
m Co
mpilation
Time

I l U 7 0 1 4 0 '0 34

I Question
Revisit Choose the best option

Which of the following is false about static 0 Static methods can access other static members directly.

0 Non static methods cannot access other static members


directly. 0 Static Import can access directly all the static
members of class.

I Question # Choose the best

Which of these is used as a default for a member of a class if no access specifier m


P
u
bl
ic
..11 •

I Question # 9
Which is the correct syntax to make a single dimensional array?
(6 Revisit
Choose the best option

m int
a( j=new Int
[51:

 int
a =new int[51;

7 8 9 10 < 100140 >

1 Question # 10
Revisit Choose the best option

What is the aim of the following code? 0 To create an image file


import java.lo.File; 0 To delete an image file
import java.io.FifelnputStream;
import java.lo.10Exception; 0 To read the file through input stream
public class FiletnputStreamExample
0 To write the file through output stream
public static void main(String args[j) throws I0Exception
File file = new File("C:/Java Program/auto.jpg ");
FilelnputStream inputStream = new FilelnputStream(file);
byte bytes[i = new byte[(int) file.lengthob
int numOfBytes = inputStream.read(bytes);
System.out.println("Data copied successfully...");
System.out.println(numOrBytes):

I UK ••■•J

Rev

I Question 1 11
Choose the best option

0 Nothing
Calculate the output of the following code snippet.
interface A( ) 0 b is an instance of A. o b is an instance of C. 0 b is
class C ( ) an instance of A followed by b is an instance of C.
class D extends C }
class B extends D Implements A (
public class Test extends Thread(
public static void main(String0 args)(
8 b•new 8();
if (b inslanceof A)
System Out.printin•b Is an instance of A").
if (b instanceof C)
Systernoul println('b is an instance of C•):

I Question X 12
When is it decided if a method should be overloaded?
q'y Revisit Choose the best option

m At run
time

m At
compile time
o At
130140

I Question # 13
Revisit Choose the best option

Which of the following Is an example of a garbage collection method? m Sweep model

m Mark and sweep model 0


Space management model 0 Cleanup
model

I
< 14 0140
(-•• Revisit Choose the best option
Question # 14
int x = 100; m
In this example, Literal(Constant) is: nt

4V > NI

I Question 1 15
(4
Revisit Choose the best option

Anonymous Inner Class can 0 be extended by another class

0 not be instantiated
have a name
0 access the members of its outer cress

1 Question 1 16
What will be the output of the following code snippet?
Revisit Choose the best option

m
Int a=15; Err
int b=25; or
if ((a < b )(1( a = 5)>15)
m
System.outprintin(a); 1
5
else
System.out.println(b);
Choose the best option

I Question 017
Question
Which of the# 18 statement Is false?
foricwing
40:Checked Choose the exceptions
& Unchecked best optionare detected or occur only In run-time.
0 Javac by default handles the checked exceptions instead of forcing upon th
m must be defined as first statement
mfinally block always survives except System .exit(0)
Enum Constant  is an object of type enum
mthrows keyword Is for satisfying javac instead of Java

m is implicitly private static final

m ordinal value starts from 1

Choose the best option


Question # 19
m (param) -> System.out.printtn("paramet
Choose the incorrect syntax for a lambda expression");
expression.
m 0 -> System.out.println("lambda expre

m (String s) -> (lambda expression of typ


m 0 -> 3.567

I Question # 20
If there are multiple operators in the expression, then they will follow the rule of
Revisit C hoose
Choose the best
Question # 21 option

Method Overloading has multiple methods m Same method name but different number or datatype
of arguments.

m Same method name & same number of


arguments

m Same method name & same data type of


arguments

m All of the Above

I class Student implements Studentinfo,

Stude public void displayinfoo


Q

u
System.out.println("Roll
e No:"•rollno);
System.out.println("Name:"+n
s ame);

t public void displayMarks()

i System.out.println('ki3 Marks:-+M3):
System.out.println("OOP
o Marks :"+00P):

n
public class Sample

2
I
What is the output ol the following code?
Questi

on F 23

int rollnoz01;
String narne="Ronar:
public void dIsplayInfo();

interface StudentMarks

int M3.50;
int 00P870:
public void dIsplayMarksa

Class Student implements StudentInto, StudentMarks


C 0 Roll No: 1
h
o Name: Ronak
o
s 0 Roll No: 1
e Name: Ronak
t
M3 Marks:
h OOP Marks: 70
e

b (
e .
s
t
.
)
o
p E
t r
i r
o o
n r

R
o
l
l

N
o
:

N
a
m
e
:

R
o
n
a
k

M
3

M
a
r
k
s RevliA
Choose
: the
best
5 option
0

I. air a' the fallowing statement is correct to cit peck the largest number from girlies.% ihree
nurrt.rs?

("
C


cc L4 Z4 < 24 cd 40 >

I Ouestion # 24

Which of the following is true about HasliMap<K. V> API?

I Qu
SO Lu

21

estion I 22
23
25 24

When 25
do you
< 25
expect
the of 40 >
daemon

111
thread
to be
terminat
ed?
4

R
e
v
i
s
i
t
Choose the
b
e
s
t

o
p
t
i
o
n
0 Once all non daemon threads execution is completed
CI When wait() method is called
0 When interrupt() method is called
None of these

I Question At 26
A place where a class's objects are kept Is called as :
I Question / 27
What type of conversion is shown in the following code?
long 1=100; int i=(int) I;

La 26 27 28

I Question 1 28
Choose the best
option

0 OR A Relation
0 AND A
Relation 0 HAS
A Relation O
Zs 24 25 28 27
28 29

I Question # 29
Collections.emptySet0 is used to get :
(!) Revisit Choose the best option

m Mutable HashSet

m I mmu t a bl e S et

 Non•Serializable Set

 No Such method

irt 22 23 24 26 24 27
28 29 30 10o

1I
Choose the best option
' Revisit Choose the best option
Question s 10
Question H 31 It is not used to break abstraction
What wi, be the output of the following 0 C•11.C*2
Which of the following is true about Reflection? 0 It is used to access private method using its class object
0 C.I.C.2.C.3
0 Used to access only public variables
static tht c = 0; 0
public static void misin(String0 Used to access only commo C •vanables
1.C.2.C.3.C•4

W wl • c();
W •
c(w1);
W w3 •
c(w2);
N
W w4 •
c(w3);
J1- < 32 of 40
private W()

I
System out print:We c).
". Revisit Choose the best option
static W X 32
Question
What will be the output ifSampte.java does not have the main 0  Compile time error
return eir. <= n 7 method?
using javac command.

static W c(W  Run time error using


Java command.

0 Class will get executed vrithout any


I Question N 33
Choose the best option

0 Welcome and IllegalThreadStateExceplion


What wilt be the output for the following code?
publlcclass Test implements Runnable Welcome, Welcome and IllegalihreadStateException
( publicstabcvold main(String0 args) throws InterruptedException
IllegalThreadStateException
{ Thread thread = new Thread(new Test());
thread.start(); thread.start(),thread.starl(): 0 Welcome, Welcome, Welcome
System.out.lxintln(thread.gelState());

publicvoid run() { System.out.printIn('iNelcome"): }

Choose the best option


Question X 34

What is false about constructor? 0 Constructors cannot be synchronized in Java


0 Java does not provide default copy constructor
0 Constructor can have explicit return type
0 "this" and "super" can be used in a constructor

I Question Si 35
Choose the best option
What will be the output of the fonovring code?
class Except_H
m A
public static void main(String
t m B

int a. m Compilation
b; b Error
a=5/b;
m Runtime
Error
catch(ArithmeticException e)

System.out.print('EV);

I Question X
Choose the bast option
 •

36
O  •
What is the output of the following code?  ••
import )ava.io.•:
public class Hello

public static void printsr(int n)

O
int i, j; C
for(1.0;

Pcn;

 •
for(j-0; j-c. , i; J..)

System.out.pnnt(-").
0
Systcrn.out printina

public static void masn(String argsf ►

intn - 5 :
peintsr(n):
I Question # 37 Revisit Choose the best option

Choose the correct set of String class methods from the following: m charAt, compareTo,
containAll

m cepyValue0f, format,
valueAt

m endsWith,length,intern

o0 3b 37 38 ":$9
40 < 38 of 40

I Question # 38
"Object value = 13.401:- represents
Revisit
Choose the best option

m Generalization and Down


Casting 0 Widening and Up Casting

m Composition and Down


Casting 0 Auto Boxing and Up
Casting

.14 JJ 34 35 36 37 36 39 rin < 39

I Question # 39
Just In Time
- - Compiler increases the efficiency of
Revisit Choose the best option

m Compiler

m Interpreter
m Garbage
Collector

m Resource

JP 36
37 40

I Question # 40 Revisit Choose the best option

Which of the following can be used to move thread from waiting state to runnable state? 0 using yield method

m using start method

m using awake method

m using notilyAll method

You might also like