Adblocker Detected
Quizack provides Online Quiz and Practice MCQs for Free. Please disable your Ad-Blocker so we can earn from ads and keep this project alive.
1. When you are working with a ________, you are using a storage location that holds a piece of data.
2. When an expression containing a ____ is part of an if statement, the assignment is illegal.
3. When a parameter is a(n) ______ data type, any changes made in a method are preserved.
4. To prevent a class from being instantiated, ________.
5. To guarantee that the member variables of a class are initialized, you use ____.
6. The term ________ typically refers to the device that displays console output.
7. The name of the ____ is always the same as the name of the class whose objects it constructs.
8. The iterator() method is defined in the ________ interface.
9. The conditional operator ?: takes ____ arguments.
10. The capability to inherit from more than one class is called ____.
11. Java and c++ are _____ languages.
12. If a compiler detects a violation of language rules, it refuses to translate the class to ____.
13. Fill in the code in comparable________ c = new date();
14. A sentinel value ________ and signals that there are no more values to be entered.
15. A method that is associated with an individual object is called ________.
16. You use a ____ following the closing brace of an array initialization list.
17. Whenever a method requires multiple arguments, the arguments are always separated with ____.
18. When you use the && operator, you must include a complete _____ on each side.
19. When working with logical operators, you can always use ____ to change precedence.
20. The characters ____ move the cursor to the next line when used within a println() statement.
21. Method names that begin with ____ and set are very typical.
22. Method calls cannot be distinguished by ________.
23. An if statement that appears inside another if statement is referred to as __________.
24. A(n) ____ comparison is based on the integer Unicode values of the characters.
25. From which class do all other classes implicitly extend?
26. What keyword is added to a method declaration to ensure that two threads do not simultaneously execute it on the same object instance?
27. An _ is a serious issue thrown by the JVM that the JVM is unlikely to recover from. An _ is an unexpected event that an application may be able to deal with in order to continue execution.
28. Which code checks whether the characters in two Strings,named time and money, are the same?
29. What language feature allows types to be parameters on classes, interfaces, and methods in order to reuse the same code for different data types?
30. Which statement about constructors is not ture?
31. Which choice is the best data type for working with money in Java?
32. Which language feature ensures that objects implementing the AutoCloseable interface are closed when it completes?
33. You have a variable of named employees of type List containing multiple entries. The Employee type has a method getName() that returns te employee name. Which statement properly extracts a list of employee names?
34. Which class does not implement the java.util.Collection interface?
35. Which class acts as root class for Java Exception hierarchy?
36. You have an instance of type Map named instruments containing the following key-value pairs: guitar=1200, cello=3000, and drum=2000. If you add the new key-value pair cello=4500 to the Map using the put method, how many elements do you have in the Map when you call instruments.size()?
37. What will this code print, assuming it is inside the main method of a class?System.out.println("hello my friends".split(" ")[0]);
38. Which characteristic does not apply to instances of java.util.HashSet=
39. Which code snippet is valid?
40. In Java, what is the scope of a method's argument or parameter?
41. What phrase indicates that a function receives a copy of each argument passed to it rather than a reference to the objects themselves?
42. When should you use a static method?
43. Which operator is used to concatenate Strings in Java
44. How would you convert a String to an Int?
45. What type of variable can be assigned to only once?
46. Which access modifier makes variables and methods visible only in the class where they are declared?
47. Which is not a valid lambda expression?
48. Using Java's Reflection API, you can use _ to get the name of a class and _ to retrieve an array of its methods.
49. Java programmers commonly use design patterns. Some examples are the _, which helps create instances of a class, the _, which ensures that only one instance of a class can be created; and the _, which allows for a group of algorithms to be interchangeable.
50. How do you force an object to be garbage collected?
51. What kind of relationship does "extends" denote?
52. What is a valid use of the hashCode() method?
53. Which functional interfaces does Java provide to serve as data types for lambda expressions?
54. Declare and initialize an array of 10 ints.
55. Which choice is a disadvantage of inheritance?
56. Which operator would you use to find the remainder after division?
57. What language construct serves as a blueprint containing an object's properties and functionality?
58. Declare a variable that holds the first four digits of Π
59. Why are ArrayLists better than arrays?
60. Which keyword lets you use an interface?
61. Normally, to access a static member of a class such as Math.PI, you would need to specify the class "Math". What would be the best way to allow you to use simply "PI" in your code?
62. Which keyword lets you call the constructor of a parent class?
63. If you encounter UnsupportedClassVersionError it means the code was ___ on a newer version of Java than the JRE ___ it.
64. You get a NullPointerException. What is the most likely cause?
65. How does the keyword volatile affect how a variable is handled?
66. Which type of variable keeps a constant value once it is assigned?
67. Which are valid keywords in a Java module descriptor (module-info.java)?
68. What method signature will work with this code? boolean healthyOrNot = isHealthy(
69. Which is the most reliable expression for testing whether the values of two string variables are the same?
70. What method can be used to create a new instance of an object?
71. What statement returns true if "nifty" is of type String?
72. Object-oriented programming is a style of programming where you organize your program around _ rather than _ and data rather than logic.
73. Which statement is NOT true?
74. The runtime system starts your program by calling which function first?
75. Fill in the blank to create a piece of code that will tell whether int0 is divisible by 5: Boolean isDivisibleBy5 = _____
76. Which is the most up-to-date way to instantiate the current date?
77. By implementing encapsulation, you cannot directly access the class's _ properties unless you are writing code inside the class itself.
78. You have an ArrayList of names that you want to sort alphabetically. Which approach would NOT work?
79. What does this code print? System.out.print("apple".compareTo("banana"));
80. How do you write a foreach loop that will iterate over ArrayListpencilCase?
81. Given the following definitions, which of these expression will NOT evaluate to true? Boolean b1 = true, b2 = false; int i1 = 1, i2 = 2;
82. How can you achieve runtime polymorphism in Java?
83. Given the string "strawberries" saved in a variable called fruit, what would fruit.substring(2, 5) return?
84. Data items you use in a call to a method are called ____.
85. A literal string is a(n) ____ object.
86. Abc.compareto("aba") returns ________.
87. If a program compiles fine, but it produces incorrect result, then the program suffers __________.
88. In an interview, ____ limit or restrict the response.
89. You can use the ________ method to force one thread to wait for another thread to finish.
90. Java, c#, and vb.net are examples of ________.
91. On many keyboards, the break key is also the ____ key.
92. To register a source for an action event with a handler, use ________.
93. The compiler checks ________.
94. The following code causes java to throw ________. int number = integer.max_value + 1;
95. The class used as a basis for inheritance is the ____ class.
96. Polymorphism means ________.
97. In java, boolean array elements automatically are assigned the value ____.
98. If you attempt to add an int, a byte, a long, and a float, the result will be a ________ value.
99. In java, you use variables of type ____ to store integers, or whole numbers.
100. An immutable class cannot have ________.
SQL
MySQL
jQuery
C#
Python
Ajax
Related MCQ's