Free IT Courses Java Worksheets

Download free printable Java Worksheets to practice. With thousands of questions available, you can generate as many Java Worksheets as you want.

Download Worksheet

Sample IT Courses Java Worksheet Questions

1.

Which of the following are valid access modifiers in Java? Select only one option.

1.

private, protected, public, default

2.

private, protected, public, no specifier

3.

private, protected, public, extends, implements

4.

private, protected, package, public

2.

Which of the following is incorrect for java identifiers? Select only one option.

1.

It can contain alphabets, digits, '_' or '$' but can’t start with digits.

2.

There is no length limit for a Java identifier.

3.

It can use java reserved words.

4.

It can use all predefined java class names & interface names.

3.

Abstraction vs Encapsulation in OOP. Select the correct option.

1.

Both are same

2.

Their is nothing called Abstraction or Encapsulation in OOP

3.

Abstraction is about what to expose to client and Encapsulation is about the internal impleentation

4.

Abstraction is about the internal implementation and Encapsulation is about what to expose to client

4.

Is Java a purely OOP? Select one correct answer

1.

Yes

2.

No

3.

May be

4.

May be not

5.

What happens when the following code is compiled and run. Select the one correct answer.


 

for(int i = 1; i < 3; i++)

  for(int j = 3; j > i; j--)

     assert i!=j {System.out.println(i); }

 

1.
(A) The class compiles and runs, but does not print anything.
 
 
2.
(B) The number 1 gets printed with AssertionError
 
3.
(C) The program generates a compilation error.
 
4.
(D) The number 2 gets printed with AssertionError
 
6.

Given a one dimensional array 'arr', what is the correct way of getting the number of elements in 'arr'? Select the correct answer only.


1.
(A) arr.length
2.
B) arr.size
3.
(C) arr.length()
4.
(D) arr.size()
7.

 
1.
(A) Set
 
2.
(B) SortedSet
 
3.
(C) Tree
 
4.
D) SortedMap
 
8.

The class Hashtable is used to implement which collection interface. Select the one correct answer.

1.
(A) List
 
 
2.
(B) Set
 
 
3.
(C) Map
 
 
4.
(D) SortedSet
 
 
9.

Which of these are legal identifiers. Select the three correct answers.


a. number_1

b. number_a

c. $1234

d. -volatile
1.
(A) a, b, c
 
2.
(B) a, b
 
3.
(C) a
 
4.
(D) b
 
10.

 
1.
(A) An instance of a class is an object
 
2.
(B) Objects can access both static and instance data
 
3.
(C) Objects do not permit encapsulation
 
4.
(D) Object is the super class of all other classes
 

Worksheets by UrbanPro

A little About Us

Our worksheets are designed to help students explore various topics, practice skills and enrich their subject knowledge, to improve their academic performance. Designed by Experts who have extensive experience and expertise in teaching a subject, these worksheets will improve your child's problem-solving skills and subject knowledge in a fun and interactive manner.
Check out our free customized worksheets across school boards, grades, subjects and levels of subject knowledge. You can download, print and share these worksheets with anyone, anywhere, anytime!

Get a custom worksheet to practice!

Select your topic & see the magic.

subject

Select a subject*

Core Java Hibernate J2EE JSP JSP (Java Server Pages) Servlet Spring Struts Struts Web services

Please select another category

Select Chapter(s)

Chapters & Subtopics

Advanced»

Select type of questions

Select the length of worksheet

Questions (5 to 100)

No of questions have to be between 5 to 100