WorksheetsJava Fundamentals
Total questions: 24
Worksheet time: 22mins
Reorder the following Java program structure
package helloworld;
public class HelloWorld{
public static void main (String [ ] args) {
System.out.println("Hello World from Java");
}
}
+
-
*
/
%
+=
-=
*=
/=
%=
==
>
<
<=
>=
!=
&&
||
!
++
Drag the following missing parts of for loop to its correct place in order to display numbers from 1 to 10. for ( (a) x<=10; (b) ){
System. (c) println( (d) ) (e)
Match the following
5
5.2
'a'
"abc"
true
Print "Hello World" if x is greater than y.
(a) x (b) 50 (c) y = 10;
(d) (x (e) y) {
System.out.println("Hello World");
}
Insert the missing parts to complete the following switch statement. (a) day = 2;
switch ( (b) ) {
(c) 1: System.out.println("Saturday");
(d)
case (e) : System.out.println("Sunday");
break;
}
Who invented Java Programming?
What is the main aim of OOP?
What are the advantages of using OOP?
It helps in structuring and organizing complex code using objects and classes.
It increases code duplication and redundancy.
It eliminates the need for classes and objects.
It makes code more confusing and difficult to understand.
What is encapsulation in OOP?
It is a process of hiding the internal details of an object and providing access only through public methods.
It is a process of exposing the internal details of an object and providing direct access to its properties.
It is a process of creating multiple instances of an object.
It is a process of defining the structure and behavior of an object.
What is inheritance in OOP?
It is a process of hiding the internal details of an object and providing access only through public methods.
It is a process of exposing the internal details of an object and providing direct access to its properties.
It is a process of creating multiple instances of an object.
It is a process of acquiring properties and behaviors from a parent class.
Which access specifier allows a method to be accessible in all classes?
What is the purpose of a method body?
What is the purpose of data abstraction in OOP?
What is an object?
What is a class?
What is the difference between a class and an object?
What is polymorphism?
What is a try/ catch block?
Which statement is true about Java?
Which component is used to compile, debug and execute the java programs?
Reorder the following java operators according to its precedence.
()
++
*
+
&&
Match the following data type based on its description.
store whole numbers
Stores fractional numbers
char
Stores a single character/letter
boolean
Stores true or false values
array
collection of elements
Type your full name:
