wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OOP - Fast Track Exam - 23.01.2021

Total questions: 150

Worksheet time: 1hrs 19mins

Name
Class
Date
1.

A __________ is the physical/logical entity.

a)

Thing

b)

Objects

c)

Classes

d)

Behavior

2.

Below are the list of three characteristics of an Object EXCEPT ONE. What is it?

a)

Behavior

b)

Attribute

c)

State

d)

Identity

3.

REALME - ASUS - ANDROID PHONE - HUAWEI - SAMSUNG - MOBILE PHONE


In the list above, what are the sample of objects?

a)

REALME, ASUS, ANDROID PHONE, HUAWEI

b)

MOBILE PHONE, SAMSUNG, ANDROID PHONE, ASUS

c)

ASUS, REALME, HUAWEI, SAMSUNG

d)

SAMSUNG, MOBILE PHONE, ASUS, REALME

4.

What are the sample of classes in the list below?

a)

Programming Language

b)

Python

c)

Java

d)

C++

5.

A keyword used to initialize an object.

a)

OLD

b)

CLONE

c)

METHOD

d)

NEW

6.

Which among the following best describes encapsulation?

a)

It is a way of combining various data members into a single unit

b)

It is a way of combining various member functions into a single unit

c)

It is a way of combining various data members and member functions into a single unit which can operate on any data

d)

It is a way of combining various data members and member functions that operate on those data members into a single unit

7.

If data members are private, what can we do to access them from the class object?

a)

Create public member functions to access those data members

b)

Create private member functions to access those data members

c)

Create protected member functions to access those data members

d)

Private data members can never be accessed from outside the class

8.

Which feature can be implemented using encapsulation?

a)

Inheritance

b)

Abstraction

c)

Polymorphism

d)

Overloading

9.

Which inheritance in java programming is not supported

a)

Multiple inheritance

b)

hierarchal inheritance

c)

Multilevel inheritance

d)

Single inheritance

10.

What is subclass in java?

a)

A subclass is a class that extends another class

b)

A subclass is a class declared inside a class

c)

Both above.

d)

None of the above.

11.

If class B is subclassed from class A then which is the correct syntax

a)

class B:A{}

b)

class B extends A{}

c)

class B extends class A{}

d)

class B implements A{}

12.

Find which of the following uses encapsulation?

a)

void main(){

int a;

void fun() { int a=10;

System.out.println(a);

fun(); }

b)

class student{

int a;

public int b; };

c)

class student {

int a;

public void disp(){

System.out.println(a);

} }

d)

static topper() {

char name[10];

public int marks; }

13.

Which of this keyword must be used to inherit a class?

a)

super

b)

this

c)

extent

d)

extends

14.

Which among the following best defines abstraction?

a)

Hiding the implementation

b)

Showing the important data

c)

Hiding the important data

d)

Hiding the implementation and showing only the features

15.

If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used?

a)

Using private access specifier for data members

b)

Using class concept with both data members and member functions

c)

Using public member functions to access and manipulate the data members

d)

Data is not sufficient to decide what is being used

16.

Which of this keyword must be used to inherit a class?

a)

super

b)

this

c)

extends

d)

extent

17.

A class member declared protected becomes a member of subclass of which type?

a)

public member

b)

private member

c)

protected member

d)

static member

18.

class A

{

int i;

void display()

{

System.out.println(i);

}

}

class B extends A

{

int j;

void display()

{

System.out.println(j);

}

}

class inheritance_demo

{

public static void main(String args[])

{

B obj = new B();

obj.i=1;

obj.j=2;

obj.display();

}

}

a)

0

b)

1

c)

2

d)

Compilation Error

19.

What will be the output of the following Java program?

class A

{

int i;

}

class B extends A

{

int j;

void display()

{

super.i = j + 1;

System.out.println(j + " " + i);

}

}

class inheritance

{

public static void main(String args[])

{

B obj = new B();

obj.i=1;

obj.j=2;

obj.display();

}

}

a)

2 2

b)

3 3

c)

2 3

d)

3 2

20.

Using which of the following, multiple inheritance in Java can be implemented?

a)

Interfaces

b)

Multithreading

c)

Protected methods

d)

Private methods

21.

In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?

a)

Protected

b)

Private

c)

Public

d)

Static

22.

If super class and subclass have same variable name, which keyword should be used to use super class?

a)

super

b)

this

c)

upper

d)

classname

23.

Which inheritance in java programming is not supported

a)

Multiple inheritance using classes

b)

Multiple inheritance using interfaces

c)

Multilevel inheritance

d)

Single inheritance

24.

If class B is subclassed from class A then which is the correct syntax

a)

class B:A{}

b)

class B extends A{}

c)

class B extends class A{}

d)

class B implements A{}

25.

Order of execution of constructors in Java Inheritance is

a)

Base to derived class

b)

Derived to base class

c)

Random order

d)

none

26.

Output of following Java Program?

a)

10

b)

20

c)

Compilation Error

d)

Run Time Error

27.

Output of following Java Program?

a)

12

b)

321

c)

123

d)

23

28.

Which inheritance in java programming is not supported

a)

Multiple inheritance using classes

b)

Multiple inheritance using interfaces

c)

Multilevel inheritance

d)

Single inheritance

29.

What is subclass in java?

a)

A subclass is a class that extends another class

b)

A subclass is a class declared inside a class

c)

Both above.

d)

None of the above.

30.

Which line of code prints out "Hello World"?

a)

System.out.println("Hello World");

b)

system.out.println("Hello World");

c)

System.out.println(Hello World);

d)

System.out.printline("Hello World");

31.

What is the advantage of Exception Handling

a)

To avoid abnormal termination of a program

b)

To find out errors

c)

To Debug program

d)

None of these

32.

What is the parent class of All Exceptions in JAVA

a)

Throw

b)

Exception

c)

Error

d)

Bug

33.

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

a)

try

b)

catch

c)

finally

d)

throw

34.

try block may or may not contains catch blocks

a)

True

b)

False

35.

What is the purpose of 'throw' keyword

a)

To Raise an exception explicityly

b)

To Raise an exception implicityly

c)

To create user defined exceptions

d)

To create custom exceptions

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.

How to create our own exception

a)

using 'throw' keyword

b)

using 'throws' keyword

c)

using 'finally' keyword

d)

using 'throwable' keyword

38.

Exception classes belongs to following package

a)

import java.io.*

b)

import java.lang.*

c)

import java.util.*

d)

import java.lang.Exception.*

39.

Which of these keywords is not a part of exception handling?

a)

try

b)

finally

c)

thrown

d)

catch

40.

java.lang.NullPointerException is a

a)

Error

b)

runtime exception

c)

Compile time exception

d)

None

41.

Which of these class is highest in hierarchy in java

a)

java.lang.Exception

b)

java.lang.Error

c)

java.lang.Throwable

d)

java.lang.Object

42.

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

43.

What will it print?

a)

1

2

3

30

b)

1

2

30

c)

1

2

3

11

d)

1

2

11

44.
Which of these method of FileReader class is used to read characters from a file?
a)
read()
b)
scanf()
c)
get()
d)
getInteger()
45.
Which of these packages contain classes and interfaces used for input & output operations of a program?
a)
java.util
b)
java.lang
c)
java.io
d)
all of the mentioned
46.
Which of these class is not a member class of java.io package?
a)
String
b)
StringReader
c)
Writer
d)
File
47.
Which of these class is not related to input and output stream in terms of functioning?
a)
File
b)
Write
c)
InputStream
d)
Reader
48.
Which stream used to read data from a source, it may be a file, an array, peripheral device or socket?
a)
InputStream
b)
OutputStream
c)
Input/OutputStream
d)
None of the above
49.
Which is used for writing data to a file in file handling?
a)
FileInputStream
b)
FileOutputStream
c)
Both A & B
d)
None of the above
50.
public char[] readPassword() blongs to whcih class
a)
Scanner Class
b)
Console class
c)
InputStreamReader class
d)
DataInputStream
51.
Which method is used to close the Stream?
a)
close();
b)
flush();
c)
null();
d)
final();
52.
 Which exception is thrown by read() method?
a)
SystemInputException
b)
IOException
c)
SystemException
d)
InterruptedException
53.
Which of these class contains the methods print() & println()?
a)
PrintStream
b)
BUfferedOutputStream
c)
System.out
d)
System
54.

How many except statements can a try-except statement have?

a)

None

b)

One

c)

Two

d)

Multiple

55.

When is the finally block executed?

a)

when an exception occurs

b)

when no exception occurs

c)

never

d)

always

56.

When will the else part of try-except-else be executed?

a)

always

b)

when an exception occurs

c)

when no exception occurs

d)

never

57.

Can one except block handle multiple exceptions?

a)

Yes

b)

No

c)

May be

d)

Insufficient information

58.

The ZeroDivisionError may occur during which operation(s)?

a)

Division

b)

Modulo

c)

Both

d)

None

59.

Which of the following is FALSE about arrays on Java

a)

A java array is always an object

b)

Length of array can be changed after creation of array

c)

Arrays in Java are always allocated on heap

60.

Predict the output?

public class Main {

public static void main(String args[]) {

int arr[] = {10, 20, 30, 40, 50};

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

{

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

}

}

}

a)

10 20 30 40 50

b)

Compiler Error

c)

10 20 30 40

61.

class Test {

public static void main(String args[]) {

int arr[2];

System.out.println(arr[0]);

System.out.println(arr[1]);

}

}

a)

0

0

b)

garbage value

garbage value

c)

Compiler Error

d)

Exception

62.

public class Main {

public static void main(String args[]) {

int arr[][] = new int[4][];

arr[0] = new int[1];

arr[1] = new int[2];

arr[2] = new int[3];

arr[3] = new int[4];

int i, j, k = 0;

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

for (j = 0; j < i + 1; j++) {

arr[i][j] = k;

k++;

}

}

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

for (j = 0; j < i + 1; j++) {

System.out.print(" " + arr[i][j]);

k++;

}

System.out.println();

}

}

}

a)

Compiler Error

b)

0

1 2

3 4 5

6 7 8 9

c)

0

0 0

0 0 0

0 0 0 0

d)

9

7 8

4 5 6

0 1 2 3

63.

Which of the following is the correct way of importing an entire package ‘pkg’?

a)

import pkg.

b)

Import pkg.

c)

import pkg.*

d)

Import pkg.*

64.

Which of the following is/are advantages of packages?

a)

Packages avoid name clashes

b)

Classes, even though they are visible outside their package, can have fields visible to packages only

c)

We can have hidden classes that are used by the packages, but not visible outside.

d)

All of the above

65.

Which of these is a mechanism for naming and visibility control of a class and its content?

a)

Object

b)

Packages

c)

Interfaces

d)

None of the above

66.

Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?

a)

Public

b)

Protected

c)

No Modifier

d)

All of the mentioned

67.

Arrays in Java are dynamically allocated using the . . . . operator.

a)

create

b)

dynamic

c)

arrayList

d)

new

68.

Which of the following statements correctly declares a two-dimensional integer array?

a)

int Matrix[ ] = new int[5,4];

b)

int Matrix[ ]; Matrix = new int[5,4];

c)

int Matrix[ ][ ] = new int[5][4];

d)

int Matrix[ ][ ] = int[5][4];

69.

1. The capability to control the access of multiple threads to any shared resource is called_____________

a)

Synchronization

b)

Multitasking

c)

multithreading

d)

None

70.

Why to use synchronization?

a)

Avoiding thread interference

b)

Avoiding consistency problem

c)

Both

d)

None

71.

_______________ and __________________ are the types of synchronization.

a)

Process synchronization and thread synchronization

b)

multitasking and multithreading

c)

Interthread communication and mutual exclusion

d)

None

72.

How many Types of synchronization approaches are there under mutual exclusion?

a)

3

b)

4

c)

2

d)

0

73.

What are the approaches under mutual exclusion?

a)

Synchronized method

b)

Synchronized block

c)

Static synchronization

d)

All the above

74.

Choose the correct syntax for synchronized method.

a)

a. synchronized returntype methodname(.....)

b)

a. returntype methodname(.....)

c)

c. synchronized methodname(.....)

d)

d. None

75.

Identify the correct mutual exclusion approach:

synchronized(this)

{

….

….

}

a)

Synchronized method

b)

Synchronized block

c)

Static Synchronization

d)

None

76.

Identify the correct mutual exclusion approach:

synchronized static returntype method(parameters)

{

}

a)

synchronized method

b)

synchronized block

c)

static synchronization

d)

None

77.

__________________________ is a mechanism in which a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same critical section to be executed.It

a)

Inter thread communication

b)

Co-operation

c)

option 1 or option 2

d)

None

78.

_____________tells calling thread to give up monitor and go to sleep until some other thread enters the same monitor and call notify.

a)

wait()

b)

notify()

c)

notifyAll()

d)

start()

79.

______________wakes up a thread that called wait() on same object.

a)

start()

b)

run()

c)

notify()

d)

sleep()

80.

_________wakes up all the threads that called wait() on same object.

a)

notify()

b)

notifyAll()

c)

wait()

d)

sleep()

81.

Which is the static method?

a)

wait()

b)

sleep()

c)

Both

d)

None

82.

wait(), notify() and notifyAll() belongs to which class?

a)

Thread

b)

Object

c)

FileInputStream

d)

Exception

83.

_________thread in java is a service provider thread that provides services to the user thread.

a)

Producer thread

b)

Consumer thread

c)

Daemon thread

d)

None

84.

Daemon thread is a _________priority thread.

a)

low

b)

high

c)

Normal

d)

None

85.

wait() releases the lock on the shared resource.

a)

True

b)

False

86.

_______________is the return type of isDaemon()

a)

String

b)

int

c)

boolean

d)

float

87.

sleep() method belongs to which class?

a)

Object

b)

Thread

c)

Exception

d)

InputStream

88.

We should notify the sleep() method to wake up.

a)

True

b)

False

89.

Execution of a java thread begins on which method call?

a)

Run ()

b)

Start ()

c)

Execute ()

d)

Launch ()

90.

How many ways a thread can be created in Java multithreading?

a)

1

b)

2

c)

5

d)

10

91.

Which method is used to make main thread to wait for all child threads

a)

Join ()

b)

Sleep ()

c)

Wait ()

d)

Stop ()

92.

Default value of a java thread is

a)

0

b)

1

c)

5

d)

10

93.

If a priority of a java thread is 3 then the default priority of its child thread will be

a)

0

b)

1

c)

5

d)

3

94.

Daemon thread runs in

a)

BackGround

b)

Foreground

c)

Both

d)

none

95.

Which method is used to wait for child threads to finish in Java?

a)

Wait ()

b)

Sleep ()

c)

Join ()

d)

isAlive()

96.

Which will contain the body of the thread in Java?

a)

Start()

b)

Run()

c)

Main()

d)

Execute()

97.

The life cycle of a thread in java is controlled by

a)

JRE

b)

JDK

c)

JVM

d)

None

98.

Which method is used to get current running thread object?

a)

runningThread()

b)

currentThread()

c)

runnableThread()

d)

None

99.

Synchronized static methods acquire lock on

a)

Class

b)

Object

c)

Interface

d)

None

100.

Thread priority in Java is?

a)

Integer

b)

Float

c)

Double

d)

Long

101.

The life cycle of thread in JAVA is controlled by

a)

JDK

b)

JVM

c)

JRE

d)

None

102.

In JAVA multi threading, a thread can be created by_______

a)

Extending class

b)

Implementing Runnable Interface

c)

both

d)

none

103.

Which statements is/are correct

a)

On calling Thread start ( ) method a new thread is created

b)

Thread start( ) method call run( ) method internally

c)

Thread run( ) method can also be called directly to create thread

d)

both a & b

104.

The following example shows the creation of a

import java.applet.*;

import java.awt.*;


public class Main extends Applet{

public void paint(Graphics g){

g.drawString("Welcome in Java Applet.",40,20);

}

}

a)

a. Banner using Applet

b)

b. Basic Applet

c)

c. Display clock

d)

d. None of the above

105.

The APPLET tag is used to start an applet from both an HTML document and from an applet viewer.

a)

a. True

b)

b. False

106.

What invokes immediately after the start() method and also any time the applet needs to repaint itself in the browser?

a)

a. stop()

b)

b. init()

c)

c. paint()

d)

d. destroy()

107.

import java.awt.*;

import java.applet.*;

public class myapplet extends Applet {

public void paint(Graphics g) {

g.drawString("A Simple Applet", 20, 20);

}

}

a)

a) A Simple Applet

b)

b) A Simple Applet 20 20

c)

c) Compilation Error

d)

d) Runtime Error

108.

import java.awt.*;

import java.applet.*;

public class myapplet extends Applet {

Graphic g;

g.drawString("A Simple Applet", 20, 20);

}

a)

a) 20

b)

b) Default value

c)

c) Compilation Error

d)

d) Runtime Error

109.

How would you change the text of a label to the text contained by an integer named num;

a)

label.setText(num);

b)

label.updateText(num);

c)

label.setTest("num");

d)

label.setText(num+ "");

110.

What object type handles Java's layouts?

a)

Layout Manager

b)

Layout Scheduler

c)

Layout Operator

d)

Layout Director

111.

What is the purpose of the line of code:

import java.awt.*;

a)

To allow you to make Random number generators

b)

To use an interface.

c)

To import a package

d)

To allow you to Scan from the terminal or a file.

112.

What is a method?

a)

An organized and functionally based set of related interfaces and classes

b)

Where we type our code.

c)

A set of group of code that can be called for execution.

d)

An instance of a class

113.

Which of the lines of code DOES NOT call a method?

a)

frame.setSize()

b)

frame.setVisible(true);

c)

JFrame frame;

d)

frame.setResizable(false);

114.

JFrame, JPanel, JLabel, JButton are examples of ...

a)

methods

b)

classes

c)

interfaces

d)

packages

115.

What code adds this JButton to this JPanel?

JPanel panel = new JPanel();

JButton button = new JButton();

a)

panel.add(button);

b)

button.add(panel);

c)

frame.add(panel);

d)

panel.add(JButton);

116.

Which of the options below correctly set the background color of a JPanel called panel to the color blue? (More than one option may be correct).

a)

panel.setBackground(0,0,255);

b)

panel.setBackground(BLUE);

c)

panel.setBackground(new Color(0,0,255);

d)

panel.setBackground(Color.BLUE);

e)

panel.addBackgroundColor(BLUE);

117.

Which of the following layouts would be good to use for GUI that resembles a computer keyboard?

a)

Flow Layout

b)

Border Layout

c)

Grid Layout

d)

Null Layout

118.

Which of the following layouts would be good to use for GUI that resembles picture frame, with a big picture on the inside and little buttons around the outside?

a)

Flow Layout

b)

Border Layout

c)

Grid Layout

d)

Null Layout

119.

Which of the following layouts would be good to use for GUI that adjusts the position of objects when the screen is resized?

a)

Flow Layout

b)

Border Layout

c)

Grid Layout

d)

Null Layout

120.

Which of the following layouts would be good to use for manually placing objects on a GUI?

a)

Flow Layout

b)

Border Layout

c)

Grid Layout

d)

Null Layout

121.

To "nest" layouts means to...

a)

set up the panel like a bird's nest

b)

put a panel with a layout inside another panel with a layout

c)

the panel will have a hole in the middle for a bird to lay an egg

d)

(this is a made up term. You didn't teach this).

122.

Which items below are interfaces?

a)

ActionListener

b)

JPanel

c)

KeyListener

d)

IOException

123.

What method(s) must we include in order to implement ActionListener?

a)

paintComponent

b)

actionEvent

c)

actionPerformed

d)

keyPressed

124.

What method(s) must we include in order to implement KeyListener?

a)

keyTyped

b)

keyPressed

c)

keyReleased

d)

keyUsed

125.

What code must be included in order for a class to implement ActionListener and for a JButton click to be listened to? (select all that apply)

a)

public class question17 implements ActionListener{...}

b)

public void actionPerformed(ActionEvent e){ .. }

c)

JButton button = new JButton();

button.addActionListener(this);

d)

Nothing needs to be added. Your normal code implements ActionListener.

126.

How can we figure out which button was clicked inside our actionPerformed?

a)

e.getSource()

b)

e.getSource

c)

getSource()

d)

getButtonClicked()

e)

e.getButtonClicked()

127.

In order to make a class that inherits characteristics of JPanel, we need to use the key word...

a)

public

b)

class

c)

extends

d)

implements

e)

throws

128.

In Pong, when we drew shapes inside of our main JPanel, we overrode which method?

a)

paintComponent

b)

actionPerformed

c)

repaint

d)

keyPressed

129.

On a 1000 x 800 pixel JFrame, when we run the line of code below what shape appears on the screen?


g.fillRect(500,400, 30, 30);

a)

A filled in square that is 30 pixels by 30 pixels.

b)

A filled in rectangle that is 500 pixels wide by 400 pixels in height.

c)

A filled in rectangle that is 400 pixels wide by 500 pixels in height.

d)

The border of a rectangle that is 500 pixels wide by 400 pixels in height.

130.

On a 1000 x 800 pixel JFrame, when we run the line of code below where on the screen will the shape appear?


g.fillRect(500,400, 30, 30);

a)

The center of the rectangle will be at the coordinate 500,400

b)

The bottom right of the rectangle will be at the coordinate 30, 30

c)

The top left of the rectangle will be at the coordinate 500,400

d)

The top right of the rectangle will be at the coordinate 500,400

131.

On a 1000 x 800 pixel JFrame, when we run the line of code below where on the screen will the shape appear?


g.fillRect(100, 700, 50, 100);

a)

top right

b)

top left

c)

bottom right

d)

bottom left

132.

On a 1000 x 800 pixel JFrame, when we run the line of code below what does the rectangle look like?


g.fillRect(100, 700, 50, 100);

a)

twice as wide as it is tall.

b)

twice as tall as is wide.

c)

it's a square.

d)

7 times as tall as it is wide.

133.

Which method do we use to put text onto a panel?

a)

g.drawString(...)

b)

g.setText(...)

c)

g.setColor(...)

d)

g.fillRect(...)

134.

Is String a primitive data type?

a)

Yes

b)

No

c)

Both

135.

Which method to use to find length of a string?

a)

length()

b)

size()

c)

long()

d)

count()

136.

Which data type gets returned from length() method in String class?

a)

double

b)

String

c)

int

d)

number

137.

String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";


What is the correct way to find the length of "txt" string?

a)

int len = length(txt);

b)

float len = txt.length();

c)

int len = txt.length();

d)

double len = length(txt);

138.

Which is correct method to convert String into uppercase

a)

changeUpperCase()

b)

convertUpperCase()

c)

toUpper()

d)

toUpperCase()

139.

String txt = "Hello World";

System.out.println(txt.toUpperCase());


Choose the correct output.

a)

"HELLO WORLD"

b)

HELLO WORLD

c)

Hello world

d)

Hello World

140.

Choose correct purpose of indexOf() in String class.

a)

returns the index (the position) of the last occurrence of a specified text in a string

b)

returns the character of the first occurrence of a specified character in a string

c)

returns the index (the position) of the first occurrence of a specified text in a string (excluding whitespace)

d)

returns the index (the position) of the first occurrence of a specified text in a string (including whitespace)

141.

String x = "10";

String y = "20";

String z = x + y;

System.out.println(z);

Guess the output.

a)

1020

b)

10 20

c)

30

d)

"10 20"

142.

What will be the output of below code?


String statement = "Outfit of the day";

System.out.println(statement.Substring(3,6));

a)

it of

b)

tfit

c)

fit

d)

FIT

143.

Choose most appropriate purpose of trim() method in String?

a)

to remove white spaces

b)

to get a substring of the string

c)

to cut String at desired index

d)

to remove extra white spaces from start and end of String

144.

What is the return type of equalsIgnorecase() method?

a)

int

b)

String

c)

char

d)

boolean

145.

What is the most appropriate way to check if two Strings are identical?

a)

string1 == string2

b)

string1.equals(string2)

c)

string1.same(string2)

d)

string1.equalsIgnorecase(string2)

146.

(Multiple answer question)

Pick all NON-primitive datatypes from below :

a)

String

b)

int

c)

primitive

d)

Array

147.

int[] myArray = {11, 22, 33, 44, 55};

which code is correct to print length of above int-array?

a)

System.out.println(int[].myArray.length());

b)

System.out.println(myArray.length);

c)

System.out.println(myArray.length());

d)

System.out.println(int[].myArray.size());

148.

String[] friends = {"John", "Mike", "Samantha", "Monica"};

which code is correct to print "Samantha" using array functionality?

a)

System.out.println(friends[2]);

b)

System.out.println(friends[3]);

c)

System.out.println(friends["Samantha"]);

d)

System.out.println(friends{2});

149.

Select correct code to create an array of "double" datatype of length 5.

a)

double arr = double[5];

b)

double{} arr = new double{5};

c)

double[5] arr = new double[];

d)

double[] arr = new double[5];

150.

What is the correct relation between length and last-index of array?

a)

last-index is always 1 more than the length

b)

last-index is 1 less than the length (but not always)

c)

last-index is always 1 less than the length

d)

last-index is always equal to the length