What is the correct way to declare a variable that will hold a floating-point number in Java?
Anonymous Quiz
34%
a) float x;
10%
b) double x;
46%
c) float x = 5.0;
10%
d) double x = 5.0;
✍15👍5🔥4🫡3❤🔥1👨💻1
Which of the following statements is true about the compareTo method in Java?
Anonymous Quiz
29%
a) It is used to compare the memory addresses of two objects.
16%
b) It is a method of the Object class.
45%
c) It is used to compare the values of two objects.
9%
d) It is only applicable to primitive data types.
👍10❤🔥2
What is the correct way to declare and initialize an array in Java?
Anonymous Quiz
11%
a) array = [1, 2, 3];
34%
b) int array[] = new int[]{1, 2, 3};
34%
c) int array[3] = {1, 2, 3};
22%
d) int[] array = {1, 2, 3};
👍9🥰2😢1
What is the purpose of the finally block in a Java try-catch-finally statement?
Anonymous Quiz
24%
a) To handle exceptions.
57%
b) To execute code regardless of whether an exception is thrown or not.
14%
c) To specify code that will throw an exception.
5%
d) To indicate that the code is unreachable.
👍7🕊2
Which of the following statements is true about the ArrayList class in Java?
Anonymous Quiz
20%
a) ArrayList is a synchronized collection.
33%
b) Elements in an ArrayList must be of the same data type.
38%
c) ArrayList automatically resizes itself when elements are added or removed.
9%
d) ArrayList does not allow duplicate elements.
👍6🕊2
What is the default value of a boolean variable in Java?
Anonymous Quiz
31%
a) true
33%
b) false
24%
c) null
12%
d) 0
👍12
Which keyword is used to define an interface in Java?
Anonymous Quiz
55%
a) interface
13%
b) class
23%
c) implements
9%
d) extend
👍4✍2
What is the purpose of the static keyword in Java?
Anonymous Quiz
26%
a) It indicates that a variable is constant.
12%
b) It is used to define a class within another class.
54%
c) It is used to declare a method that can be called without creating an instance of the class.
8%
d) It is used to make a class immutable.
👍7❤🔥1
Which method is used to convert a string to an integer in Java?
Anonymous Quiz
55%
a) parseInt()
22%
b) parseInteger()
16%
c) toInteger()
7%
d) valueOf()
👍5❤🔥2✍1
What is the role of the this keyword in Java?
Anonymous Quiz
60%
a) It refers to the current instance of the class.
14%
b) It is used to create a new instance of a class.
16%
c) It is used to call a method of the superclass.
10%
d) It refers to the parent class of the current class.
👍8
Which of the following is used to implement multiple inheritance in Java?
Anonymous Quiz
58%
a) Interfaces
30%
b) Abstract classes
5%
c) Enums
7%
d) Packages
👍7🫡1
How do you declare a constant variable in Java?
Anonymous Quiz
21%
a) Using the constant keyword
42%
b) Using the final keyword
29%
c) Using the const keyword
9%
d) Constants cannot be declared in Java
👍8🤩2
Which method is used to compare two strings in a case-insensitive manner in Java?
Anonymous Quiz
30%
a) equalsIgnoreCase()
23%
b) equals()
23%
c) compareToIgnoreCase()
24%
d) compareTo()
👍6
What is the purpose of the new keyword in Java?
Anonymous Quiz
69%
a) To allocate memory for a new object
14%
b) To declare a new variable
12%
c) To create a new class
5%
d) To invoke a static method
👍7👌4
Which collection class in Java is synchronized?
Anonymous Quiz
44%
a) ArrayList
23%
b) LinkedList
20%
c) HashMap
13%
d) Vector
👍13🕊3
What does the super keyword represent in Java?
Anonymous Quiz
12%
a) It refers to the subclass.
29%
b) It refers to the current instance of the class.
55%
c) It refers to the superclass.
4%
d) It refers to the static context.
☃16👍3🔥1
How do you read user input from the console in Java?
Anonymous Quiz
22%
a) Using System.in.read()
48%
b) Using Scanner
22%
c) Using Console.readline()
8%
d) Using BufferedReader
👍10🤷♂3🥴2
Which method is used to find the length of a string in Java?
Anonymous Quiz
58%
a) length()
9%
b) size()
6%
c) count()
28%
d) strlen()
👍7🤷♂4
Which protocol is used for secure communication over a computer network?
Anonymous Quiz
8%
a) FTP
28%
b) HTTP
57%
c) HTTPS
7%
d) SMTP
👍4❤🔥3❤3✍1
What is the purpose of the Domain Name System (DNS) in computer networks?
Anonymous Quiz
11%
a) To encrypt data transmission
31%
b) To provide dynamic IP addresses
50%
c) To translate domain names into IP addresses
9%
d) To establish secure connections
👍5🔥3