wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

10211CS204 -OOPS using Java

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

Which of the following option leads to the portability and security of Java?

a)
  1. Bytecode is executed by JVM

b)

The applet makes the Java code secure and portable

c)
  1. Use of exception handling

d)
  1. Dynamic binding between objects

2.

Which of the following is not a Java features?

a)
  1. Dynamic

b)
  1. Architecture Neutral

c)
  1. Use of pointers

d)
  1. Object-oriented

3.

Which of the following for loop declaration is not valid?

a)
  1. for ( int i = 99; i >= 0; i / 9 )

b)
  1. for ( int i = 7; i <= 77; i += 7 )

c)
  1. for ( int i = 20; i >= 2; - -i )

d)
  1. for ( int i = 2; i <= 20; i = 2* i )

4.

Which method of the Class.class is used to determine the name of a class represented by the class object as a String?

a)
  1. getClass()

b)
  1. intern()

c)
  1. getName()

d)
  1. toString()

5.

Which package contains the Random class?

a)
  1. java.util package

b)
  1. java.lang package

c)
  1. java.awt package

d)
  1. java.io package

6.

Which option is false about the final keyword?

a)
  1. A final method cannot be overridden in its subclasses.

b)
  1. A final class cannot be extended.

c)
  1. A final class cannot extend other classes.

d)
  1. A final method can be inherited.

7.

Which of the following is a type of polymorphism in Java Programming?

a)

Multiple polymorphism

b)

Compile time polymorphism

c)

Multilevel polymorphism

d)

Execution time polymorphism

8.

What will be the output of the following Java program?

  1. class Output

  2. {

  3. public static void main(String args[])

  4. {

  5. int arr[] = {1, 2, 3, 4, 5};

  6. for ( int i = 0; i < arr.length - 2; ++i)

  7. System.out.println(arr[i] + " ");

  8. }

  9. }

a)

1 2 3 4 5

b)

1 2 3 4

c)

1 2

d)

1 2 3

9.

Which of these keywords is used to define interfaces in Java?

a)

intf

b)

Intf

c)

interface

d)

Interface

10.

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

a)

ArrayList

b)

Abstract class

c)

Object class

d)

String

11.

Which of these class is superclass of String and StringBuffer class?

a)

java.util

b)

java.lang

c)

ArrayList

d)

None of the mentioned

12.

Which of this method of class String is used to obtain a length of String object?

a)

get()

b)

Sizeof()

c)

lengthof()

d)

length()

13.

Which of these constructors is used to create an empty String object?

a)

String()

b)

String(void)

c)

String(0)

d)

None of the mentioned

14.

What will be the output of the following Java program?

  1. class String_demo

  2. {

  3. public static void main(String args[])

  4. {

  5. char chars[] = {'a', 'b', 'c'};

  6. String s = new String(chars);

  7. System.out.println(s);

  8. }

  9. }

a)

a

b)

b

c)

c

d)

abc

15.

Which of these operators can be used to concatenate two or more String objects?

a)

+

b)

+=

c)

&

d)

II