Java

A vibrant and engaging illustration of Java code being written, with colorful elements showcasing key programming concepts like variables, loops, and object-oriented programming. The image should reflect a sense of learning and technology, possibly with elements like a computer, code snippets, and symbolic representations of Java.

Java Fundamentals Quiz

Test your knowledge of Java programming concepts with our comprehensive quiz! This quiz consists of 10 multiple-choice questions designed to evaluate your understanding of key Java principles, from variables to object handling.

Whether you're preparing for an exam or looking to refresh your skills, this quiz will help you:

  • Assess your Java knowledge
  • Identify areas for improvement
  • Enhance your programming skills
10 Questions2 MinutesCreated by CodingCat42
Which of these values can a boolean variable contain?
True & False
0 & 1
Any Integer
Both a and b
Which one is a valid declaration of a boolean
Boolean b1 = 1;
boolean b2 = ‘false’;
Boolean b3 = false;
Boolean b4 = ‘true’
What is the output of this program?class mainclass { public static void main(String args[]) { char a = 'A'; a++; System.out.print((int)a); } }
66
67
65
64
Which of these constructors is used to create an empty String object
String()
String(void)
String(0)
None of the mentioned
Which of these is an incorrect statement
String objects are immutable, they cannot be changed.
String object can point to some other reference of String variable
StringBuffer class is used to store string in a buffer for later use
None of the mentioned
What is the string contained in s after following lines of code? StringBuffer s new StringBuffer(“Hello”); s.deleteCharAt(0);
Hell
Ello
Hel
Llo
Which of the following are incorrect form of StringBuffer class constructor?
StringBuffer()
StringBuffer(int size)
StringBuffer(String str)
StringBuffer(int size , String str)
Which of these methods can randomize all elements in a list?
Rand()
Randomize()
Shuffle()
Ambigous()
What is the output of this programimport java.util.*; 2. class Array 3. { 4. Public static void main(String args[]) 5. { 6. Int array[] = new int [5]; 7. for (int I = 5; I > 0; i--) 8. array[5 - i] = I; 9. Arrays.sort(array); 10. for (int I = 0; I < 5; ++i) 11. System.out.print(array[i]);; 12. } 13. }
12345
54321
1234
5432
What is the output of this program? Public class BoxDemo 2. { 3. Public static void addBox(U u, 4. java.util.List> boxes) 5. { 6. Box box = new Box<>(); 7. box.set(u); 8. boxes.add(box); 9. } 10. Public static void outputBoxes(java.util.List> boxes) 11. { 12. Int counter = 0; 13. for (Box box: boxes) 14. { 15. U boxContents = box.get(); 16. System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]"); 17. counter++; 18. } 19. } 20. Public static void main(String[] args) 21. { 22. java.util.ArrayList> listOfIntegerBoxes = new java.util.ArrayList<>(); 23. BoxDemo.addBox(Integer.valueOf(10), listOfIntegerBoxes); 24. BoxDemo.outputBoxes(listOfIntegerBoxes); 25. } 26. }
10
Box #0 [10].
Box contains [10]
Box #0 contains [10]
{"name":"Java", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of Java programming concepts with our comprehensive quiz! This quiz consists of 10 multiple-choice questions designed to evaluate your understanding of key Java principles, from variables to object handling.Whether you're preparing for an exam or looking to refresh your skills, this quiz will help you:Assess your Java knowledgeIdentify areas for improvementEnhance your programming skills","img":"https:/images/course5.png"}
Powered by: Quiz Maker