0% found this document useful (0 votes)
2 views4 pages

Java Programming Concepts and Questions

jdedjlejd;ejd;lejd;l

Uploaded by

kp6688479
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Java Programming Concepts and Questions

jdedjlejd;ejd;lejd;l

Uploaded by

kp6688479
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Find the value of A[1] after execution of the following program.

int[] A = {0,2,4,1,3};
for(int i = 0; i < [Link]; i++){
A[i] = A[(A[i] + 3) % [Link]];
}
0

12.
Arrays in java are-

Object references

objects

Primitive data type

None

13.
When is the object created with new keyword?

At run time

At compile time

Depends on the code


None

14.
Identify the corrected definition of a package.

A package is a collection of editing tools

A package is a collection of classes

A package is a collection of classes and interfaces

A package is a collection of interfaces

15.
Identify the correct restriction on static methods.

They must access only static data


They can only call other static methods.
They cannot refer to this or super.
I and II

II and III

Only III

I, II and III

16.
Identify the keyword among the following that makes a variable belong to
a class,rather than being defined for each instance of the class.

final

static

volatile

abstract
17.
Identify what can directly access and change the value of the variable
res.

package [Link];
public class Solution{
private int res = 100;
}
Any class

Only Solution class

Any class that extends Solution

None

18.
In which of the following is toString() method defined?

[Link]

[Link]

[Link]

None

19.
compareTo() returns

True

False

An int value
None

20.
Identify the output of the following program.

String str = “abcde”;


[Link]([Link](1, 3));
abc

bc

bcd

cd

You might also like