wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JECRC [BCA 2nd Year upGrad Quiz Competition - 2023]

Total questions: 62

Worksheet time: 41mins

Name
Class
Date
1.

Which statement is true about java ?

a)

Java is a sequence-depended programming language

b)

Java is a code dependent programming language

c)

Java is a platform-dependent programming language

d)

Java is a platform-independent programming language

2.

Which component is used to compile,debug and execute the java programs ?

a)

JRE

b)

JIT

c)

JDK

d)

JVM

3.

Which one of the following is not a java feature

a)

Object-oriented

b)

Use of pointers

c)

Portable

d)

Dynamic and Extensible

4.

Which of these cannot be used for a variable name in java ?

a)

Identifier & keyword

b)

Identifier

c)

Keyword

d)

None of the mentioned

5.

Which of the following is not an OOPS concept in java ?

a)

Polymorphism

b)

Inheritance

c)

Compilation

d)

Encapsulation

6.

Which of these are selection statements in java

a)

Break

b)

Continue

c)

For ( )

d)

If ( )

7.

Which of these keywords is used to define interfaces in java

a)

intf

b)

Intf

c)

interface

d)

Interface

8.

Which of the following is a superclass of every class in java ?

a)

ArrayList

b)

Abstract class

c)

Object class

d)

String

9.

Which of these packages contains the exception stack Overflow in java ?

b)

Java.system

c)

Java.lang

d)

Java.util

10.

Which of these statements is incorrect about tread ?

a)

Start() method is used to begin execution of the thread

b)

Run () method is used to begin execution of a thread before start() method in special cases

c)

A thread can be formed by implementing runnable interface only

d)

A thread can be formed by a class that extends thread class

11.

Which of these keywords are used for the block to be examined for exceptions ?

a)

Check

b)

Throw

c)

Catch

d)

Try

12.

Which one of the following is not an access modifier ?

a)

Protected

b)

Void

c)

Public

d)

Private

13.

What is the numerical range of a char data tupe in java ?

a)

0 to 256

b)

-128 to 127

c)

0 to 65535

d)

0 to 32767

14.

When does method overloading is determined?

a)

At run time

b)

At compile time

c)

At coding time

d)

At execution time

15.

When overloading does not occur ?

a)

More than one method with same name but different method signature and different number or type of parameters

b)

More than one method with same name,same signature but different number of signature

c)

More than one method with same name,same signature,same number of parameters but different type

d)

More than one method with same , same number of parameters and type but different signature

16.

What is it called if an object has its own life cycle and there is no owner

a)

Aggregation

b)

Composition

c)

Encapsulation

d)

Association

17.

Method overriding is combination of inheritance and polymorphism ?

a)

True

b)

False

18.

Which of the below is invalid identifier with the main method

a)

Public

b)

Static

c)

Private

d)

Final

19.

How can we identify whether a compilation unit is class or interface from a .class file ?

a)

Java source file header

b)

Extension of compilation unit

c)

We cannot different between class and interface

d)

The class or interface name should be postfixed with unit type

20.

What is use of interpreter ?

a)

They covert bytecode to machine language code

b)

They read high level code and execute them

c)

They are intermediated between JIT and JVM

d)

It is a synonym for JIT

21.

1. Which of this method is given parameter via command line arguments?

a)

a) main()

b)

b) recursive() method

c)

c) Any method

d)

d) System defined methods

22.

What are the Type Conversions available in Java language?

a)

A) Narrowing Type Conversion

b)

B) Widening Type Conversion

c)

A and B

d)

D) None of the above

23.

What is the output of the below Java code snippet?

char ch = 'A';//ASCII 65

int a = ch + 1;

ch = (char)a;

System.out.println(ch);

a)

A) 66

b)

B) A

c)

C) B

d)

D) 65

24.

Which type of loop is best known for its boolean condition that controls entry to the loop?

a)

A. do-while loop

b)

B. for (traditional)

c)

C. for-each

d)

D. while

25.

What will be the Output of the below code:

public class Demo{

public static void main(String[] arr){

}

public static void main(String arr){

}

}

a)

a) Nothing

b)

b) Error

c)

C) Finite

d)

d) Hii

26.

char is 2 byte in storage?

a)

True

b)

False

27.

Name the data type: '3'

a)

int

b)

char

c)

String

d)

None of the above

28.

What data type would you use for storing the number of students in a class?

a)

boolean

b)

String

c)

double

d)

int

29.
What data type would be best used to record an email address?
a)
String
b)
Integer
c)
Real
d)
Character
30.

What is the output of the below Java code snippet?

char ch = 'A';//ASCII 65

int a = ch + 1;

ch = (char)a;

System.out.println(ch);

a)

A) 66

b)

B) A

c)

C) B

d)

D) 65

31.

What is the output of the following code snippet?

int i = 0; for(i = 0 ; i < 5; i++)

{ }

System.out.println(i);

a)

A. 5

b)

B. 0

c)

C. 4

d)

D. Compilation Error

32.

Function of the Scanner class to accept a float literal from the user is

a)

nextInt( )

b)

hasNext( )

c)

next( )

d)

nextFloat( )

33.

Predict the value of k,

int k =10;

k=k+k++;

a)

11

b)

20

c)

21

d)

22

34.
Which of these is not a Thread state?
a)
New
b)
Runnable
c)
sleep
d)
terminated
35.

Which of the following key word is optional in Exception handling program

a)

try

b)

catch

c)

finally

d)

throw

36.

What is an exception

a)

Error occurred during the execution of a program

b)

Bug occurred during the compile time of a program

c)

Simply an Error

d)

It is related to input values

37.

Exception classes belongs to following package

a)

import java.io.*

b)

import java.lang.*

c)

import java.util.*

d)

import java.lang.Exception.*

38.

Choose an exception if attempt to divide number by zero


int number = 89 / 0;

System.out.println("The answer is " + number);

a)

ArithmeticException

b)

NullPointerException

c)

NumberFormatException

d)

ArrayIndexOutOfBoundException

39.

class exception_handling

{ public static void main(String args[])

{ try

{ int a, b;

b = 0;

a = 5 / b;

System.out.print("A");

} catch(ArithmeticException e)

{ System.out.print("B");

}

finally

{ System.out.print("C");

}

}

}

a)

A

b)

B

c)

AC

d)

BC

40.

Find the output for the following.

public class IncDec

{

public static void main(String s[])

{

int a = 1;

int b = 2;

int c;

int d;


c = ++b;

d = a++;


c++;


System.out.println("a = " + a);

System.out.print("b = " + b);

System.out.println("c = " + c);

System.out.print("d = " + d);

}

}

a)

a = 2 b = 3 c = 4 d = 1

b)

a = 2 b = 3 c = 4 d = 1

c)

Program does not compile.

d)

a = 1 b = 2 c = 4 d = 2

41.

What is the time complexity of this code

int a = 0, i = N;

while (i > 0)

{

a += i;

i /= 2;

}

a)

O(N)

b)

O(Sqrt(N))

c)

O(N / 2)

d)

O(log N)

42.

The complexity of Binary search algorithm is

a)

O(n)

b)

O(log n)

c)

O(n2)

d)

O(n log n)

43.

What is the time complexity of following code:

int a = 0;

for (i = 0; i < N; i++) {

for (j = N; j > i; j--) {

a = a + i + j;

}

}

a)

O(N)

b)

O(N*log(N))

c)

O(N * Sqrt(N))

d)

O(N*N)

44.

What is the time complexity of following code:

int i, j, k = 0;

for (i = n / 2; i <= n; i++) {

for (j = 2; j <= n; j = j * 2) {

k = k + n / 2;

}

}

a)

O(n)

b)

O(nLogn)

c)

O(n^2)

d)

O(n^2Logn)

45.

A linear function takes the form

a)

f(n) = an + b

b)

f(n) = an2 +bn + c

c)

f(n) = alog2n

d)

f(n) = a + b

46.

Find the slowest algorithm:

a)

O (n)

b)

O (n^2)

c)

O (n!)

d)

O (2^n)

47.

The number of executions grows extremely quickly as the size of the input increases

a)

Exponential Time

b)

Linear Time

c)

Polynomial Time

d)

Constant Time

48.

What does it mean when we say that an algorithm X is asymptotically more efficient than Y?

a)

X will be a better choice for all inputs

b)

X will be a better choice for all inputs except possibly small inputs

c)

X will be a better choice for all inputs except possibly large inputs

d)

Y will be a better choice for small inputs

49.
Consider this list of numbers: 3 4 6 7 8 9. If the number 9 was to be found using a linear search, how many comparisons need to be made?
a)
6
b)
3
c)
8
d)
4
50.
What is the main disadvantage of a binary search compared to a linear search?
a)
It requires the data to be in order
b)
It requires more memory
c)
It does not execute as quickly with larger data sets
d)
Not all CPUs are capable of executing the algorithm
51.
Consider this list of numbers L: 3 4 5 6 7 8 9. Which number would be checked first in a binary search?
a)
6
b)
3
c)
9
d)
4
52.

What is the worst case running time of the above pseudo code?

a)

O(n)

b)

O(n log n)

c)

O(n2)

d)

O(n3)

53.
What is the worst case running time of the above pseudo code?
a)
O(n)
b)
O(n log n)
c)
O(n2)
d)
O(n3)
54.

asymptotic notations represents

a)

space complexity of algo

b)

time complexity of algo

c)

both a and b

d)

none of the above

55.

Big

Ω\Omega defines

a)

lower bound

b)

upper bound

c)

middle bound

d)

none of the above

56.

What is the other name of Dijkstra algorithm?

a)

single-source shortest path problem

b)

multiple-source shortest path problem

c)

multiple-destination shortest path problem

d)

single-destination shortest path problem

57.

What is the difference between 0/1 Knapsack problem and knapsack problem by greedy

a)

In 0/1 knapsack problem we can not put some portion of object into the knapsack

b)

In knapsack problem by greedy approach we can put some portion of object also in the knapsack

c)

0/1 knapsack is example of dynamic programming

d)

All three options are correct

58.

What happens when a top-down approach of dynamic programming is applied to any problem?

a)

It increases both, the time complexity and the space complexity

b)

It increases the space complexity and decreases the time complexity.

c)

It increases the time complexity and decreases the space complexity

d)

It decreases both, the time complexity and the space complexity

59.

The following paradigm can be used to find the solution of the problem in minimum time: Given a set of non-negative integer, and a value K, determine if there is a subset of the given set with sum equal to K:

a)

Divide and Conquer

b)

Dynamic Programming

c)

Greedy Algorithm

d)

Branch and Bound

60.

Which of the following standard algorithms is not a Greedy algorithm?

a)

Dijkstra's shortest path algorithm

b)

Prim's algorithm

c)

Huffman Coding

d)

Bellmen Ford Shortest path algorithm

61.

We use dynamic programming approach when

a)

We need an optimal solution

b)

The solution has optimal substructure

c)

The given problem can be reduced to the 3-SAT problem

d)

It's faster than Greedy

62.

Which of the following standard algorithms is not Dynamic Programming based.

a)

Bellman–Ford Algorithm for single source shortest path

b)

Floyd Warshall Algorithm for all pairs shortest paths

c)

0-1 Knapsack problem

d)

Prim's Minimum Spanning Tree