Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java
Mastering Java keywords is fundamental to writing robust and efficient code. These reserved words hold special meanings within the Java language, dictating control flow, data types, and object-oriented programming constructs.
This interactive quiz will test your understanding of core Java keywords, helping you solidify your grasp of essential Java syntax and programming fundamentals. Take the quiz and see how well you can identify the correct keywords for various programming scenarios!
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
What is the type of relation that composition associations have ?
Correct
Incorrect
Question 11 of 15
11. Question
class Employee {
String empname;
Employee( String empname )
{
return empname;
}
}
class Salary {
float salary;
Salary ( String salary )
{
return salary;
}
}
class Company {
public static void main ( String args [ ] )
{
Employee e1 = new Employee(“Kumar”);
Employee e2 = new Employee(“Thakur”);
Employee e3 = new Employee(“Singh”);
Salary s1 = new Salary(15000);
Salary s2 = new Salary(13000);
Salary s3 = new Salary(10000);
HashTable<Float , String > list = new HashTable();
list.add(e1,s1);
list.add(e2.s2);
list.add(e3,s3);
System.out.println(list);
}
}
What will be the output of the program ?
Correct
Incorrect
Question 12 of 15
12. Question
class Sample {
public void display()
{
System.out.println(“Sample class is needed”);
}
}
class Concept {
Private Sample sample;
Concept(Sample sample)
{
this.sample = sample:
}
public void display()
{
sample.display();
System.out.println(“Concept is explained”);
}
}
class Main {
public static void main ( String args [ ] )
{
Sample s = new Sample();
Concept c = new Concept();
c.display();
}
}
What is the output of the program ?
Correct
Incorrect
Question 13 of 15
13. Question
Which technique is highly employed while using associations ?
Correct
Incorrect
Question 14 of 15
14. Question
class Associations {
public void print(String a )
{
return a;
}
}
class Aggregation {
public void print(String b)
{
return b;
}
}
class Composition {
public void print( String c )
{
return c;
}
}
class Main {
public static void main ( String args [ ] )
{
Associations a1 = new Associations(“Connection between two class objects”);
Aggregations a2 = new Aggregations(“Is-A relationship association”);
Composition a3 = new Composition (“Has-A relationship association”);
a2.print();
}
}
What is the output of the program ?
Correct
Incorrect
Question 15 of 15
15. Question
class Vegetables {
public void veg ( String vegetable )
{
return vegetable;
}
}
class Fruits {
public void fru ( String fruit )
{
return fruit;
}
}
class Consumable {
public static void main ( String args [ ] )
{
Vegetables v1 = new Vegetables(“Tomato”);
Vegetable v2 = new Vegetables(“Beetroot”);
Vegetable v3 = new Vegetables(“Potato”):
Fruits f1 = new Fruits(“Apple”);
Fruits f2 = new Fruits(“Orange”);
List<String> list = new List();
list.add(v1);
list.add(v2);
list.add(v3);
list.add(f1);
list.add(f2);
if(list.size==5)
{
System.out.println(“Both Vegetables and fruits are added”);
} else {
System.out.println(“Only one is added”);
}
}
What is the output of the program ?
Correct
Incorrect
Summary:
Congratulations on completing the Java Keywords Quiz! By attempting this quiz, you’ve actively reviewed essential keywords that form the backbone of Java programming. Examine both your correct and incorrect answers to identify areas for improvement. Remember, effective learning is an ongoing process.
Explore additional resources beyond the quiz, such as tutorials, documentation, and practice problems. The more you delve into Java keywords and their applications, the more confident you’ll become in crafting effective Java programs.
If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google
DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.