Java Quiz For Beginners

93 Questions  I  By Xooxa
It is created for Beginners in Java. This is to test the knowledge of any Java Developer wannabe.

  
Changes are done, please start the quiz.


Question Excerpt

Removing question excerpt is a premium feature

Upgrade and get a lot more done!
1.  Which package do you need to use widgets such as JApplet, JFrame, JPanel and JButton?
A.
B.
C.
D.
2.  If class A implements an interface does it need to implement all methods of that interface?
A.
B.
3.  What does AWT stands for ?
A.
B.
C.
D.
4.  Which one needs a web page to run
A.
B.
C.
D.
5.  Choose the appropriate data type for this value: "volatile"    
A.
B.
C.
D.
6.  What is the keyword used in java to create an object?
A.
B.
C.
D.
7.  What will be the value of “num” after the following statements? int num; num = (5+4); num = num / 9; num = 9;
A.
B.
C.
D.
8.  An array holds:
A.
B.
C.
D.
5 comments
9.  Which of the following is not a Java keyword?
A.
B.
C.
D.
10.  Choose the best definition of an object
A.
B.
C.
11.  What does GUI stand for?
A.
B.
C.
D.
12.  Choose the appropriate data type for this value: "1"    
A.
B.
C.
D.
1 comment
13.  Choose the appropriate data type for this field: isSwimmer    
A.
B.
C.
D.
14.  What is a member of a class
A.
B.
C.
D.
15.  What is an Applet ?
A.
B.
C.
D.
16.  Choose the best definition for a Class.    
A.
B.
C.
17.  What is an instanceof?
A.
B.
C.
D.
18.  Following code will result in: int num = 6.7;
A.
B.
C.
D.
19.  Given the declaration : int [ ] ar = {1,2,3,4,5}; What is the value of ar[4]?
A.
B.
C.
D.
20.  Choose the appropriate data type for this field: numberOfEggs    
A.
B.
C.
D.
21.  Object-Oriented Programming means ...  
A.
B.
C.
D.
22.  If classes Student, Staff and Faculty extend class Person, which one makes sense:
A.
B.
C.
23.  The range of indices for an array always start at:
A.
B.
C.
D.
24.  A class can be transient
A.
B.
25.  Which is not a part of defining an object?
A.
B.
C.
D.
26.  Choose the appropriate data type for this value: 1
A.
B.
C.
D.
27.  Synchronized is a keyword to tell a Thread to grab an Object lock before continuing execution.
A.
B.
28.  What is the difference between private and public functions ?
A.
B.
C.
D.
29.  With inheritance, a derived subclass object can directly access any
A.
B.
C.
D.
30.  Which one could be used as the main container in a Java application?
A.
B.
C.
D.
31.  Which of the following always need a Capital letter ?    
A.
B.
C.
D.
2 comments
32.  If you want your conditional to depend on two conditions BOTH being true, what is the proper notation to put between the two Boolean statements ?
A.
B.
C.
D.
2 comments
33.  The size of a frame is set using ...
A.
B.
C.
D.
34.  What is the role of the constructor? 
A.
B.
C.
35.  Class B inherits from Class A, what cannot be said:
A.
B.
C.
D.
1 comment
36.  What would display from the following statements? int [ ] nums = {1,2,3,4,5,6}; System.out.println((nums[1] + nums[3]));
A.
B.
C.
D.
37.  Java runs on _______.
A.
B.
C.
D.
38.  Given the declaration : int [ ] ar = {1,2,3,4,5}; What is the value of ar[3]?
A.
B.
C.
D.
39.  How is the layout of widgets on a panel specified?
A.
B.
C.
D.
1 comment
40.  Which one adds the widget mainPanel to an applet in the init method of the applet?
A.
B.
C.
D.
41.  Choose the appropriate data type for this field: kindOfBird    
A.
B.
C.
D.
42.  Following code will result in: class A { public static void main(String [] args) {B b = new A(); }} class B extends A {}
A.
B.
C.
D.
43.  What is a loop ?
A.
B.
C.
D.
44.  What loop will display each of the numbers in this array on a separate line: float [ ] nums= {1.1f, 2.2f, 3.3f};
A.
B.
C.
D.
45.  Following code will result in: class A { int x = 1; public static void main(String [] args) { System.out.println("x is " + x); }}
A.
B.
C.
D.
46.  Following code will result in: int num = 8/0;
A.
B.
C.
D.
47.  A UML association from class A to class B means
A.
B.
C.
D.
48.  How to define a JButton with the caption test?
A.
B.
C.
D.
49.  Which of the following means that in order for the conditional to happen, either x must be less than 3 or y must be greater than or equal to 4 ?
A.
B.
C.
D.
50.  An object could be ...
A.
B.
C.
D.
1 comment
51.  The following prototype shows that a Cylinder subclass is derived from a superclass called Circle
A.
B.
C.
D.
52.  A class is...
A.
B.
C.
D.
53.  What's the difference between an Applet and an application ?
A.
B.
C.
D.
54.  Methods that are marked protected can be called in any subclass of that class.
A.
B.
2 comments
55.  What is the correct syntax for java main method?
A.
B.
C.
D.
56.  The size of an applet is set using ...
A.
B.
C.
D.
57.  If we declare int [ ] ar = {1,2,3,4,5,6}; The size of array ar is:
A.
B.
C.
D.
58.  Which one is not correct?
A.
B.
C.
D.
59.  Java keywords are written in lowercase as well as uppercase.
A.
B.
60.  What is essential in making sure that your loop is not infinite ?
A.
B.
C.
D.
61.  If none of the private/protected/public is specified for a member, that member ...
A.
B.
C.
D.
62.  What is an assignment statement ?
A.
B.
C.
D.
63.  A class cannot be declared:
A.
B.
C.
1 comment
64.  An abstract class can have non-abstract methods.
A.
B.
65.  What is the main function of any variable ?
A.
B.
C.
D.
66.  Can you compare a boolean to an integer?
A.
B.
67.  Which one adds the widget mainPanel to a frame in the constructor of the frame?
A.
B.
C.
D.
68.  Given the declaration int [ ] nums = {8, 12, 23, 4, 15}, what expression will display the first element in the array (ie the number 8)
A.
B.
C.
D.
69.  Choose the appropriate data type for this value: 5.5    
A.
B.
C.
D.
70.  Choose the appropriate data type for this field: weightInKilos    
A.
B.
C.
D.
71.  What is the size of a Char in Java?
A.
B.
C.
D.
72.  What is the proper way to declare a variable ?
A.
B.
C.
D.
73.  The default statement of a switch is always executed.
A.
B.
74.  The methods wait(), notify() and notifyAll() in Object need to be called from synchronized pieces of code.
A.
B.
75.  Following code will result in: class A { public static void main(String [] args) {A a = new B(); }} class B extends A {}
A.
B.
C.
D.
76.  Native methods can be 'abstract'
A.
B.
77.  We have three classes: ATM, ATM Display and Account. The ATM has one ATM Display and works by calling methods on class Account. Which will be shown as an association in UML?
A.
B.
C.
D.
78.  Following code will result in: int a1 = 5; double a2 = (float)a1;
A.
B.
C.
D.
79.  Primitive datatypes are allocated on a stack.
A.
B.
80.  In a ‘for’ loop, what section of the loop is not included in the parentheses after “for” ?
A.
B.
C.
D.
81.  The last value in an array called ar can be found at index:
A.
B.
C.
D.
82.  The most common use of an array is to:
A.
B.
C.
D.
83.  How can you prevent a member variable from becoming serialized?
A.
B.
C.
D.
84.  Choose the appropriate data type for this value: A    
A.
B.
C.
D.
85.  Choose the appropriate data type for this value: true    
A.
B.
C.
D.
86.  Inner classes can be defined within methods.
A.
B.
1 comment
87.  A null reference may be used to access a static variable or method.
A.
B.
88.  Following code will result in: float num = 5/0;
A.
B.
C.
D.
89.  What displays from the following statements? String word = "abcde"; for (int i = 0; i <4; i+=2) System.out.print(word[i]);
A.
B.
C.
D.
90.  Choose the appropriate data type for this value: female    
A.
B.
C.
D.
91.  Which is NOT a section of all types of loops ?
A.
B.
C.
D.
92.  Integer a = new Integer(2); Integer b = new Integer(2); What happens when you do if (a==b)?
A.
B.
C.
D.
2 comments
93.  A UML association is ...
A.
B.
C.
D.
Back to top


to post comments.

Removing ad is a premium feature

Upgrade and get a lot more done!
Take Another Quiz