1) Which of the following choices makes Java portable and secure?
- Use of exception handling
- Java code is made secure and portable by the applet.
- Bytecode is executed by JVM
- Dynamic binding between objects
Answer: Bytecode is executed by JVM
2) Among the following, which are not Java features?
- Architecture Neutral
- Use of pointers
Answer. Use of pointers
3) The \u0021 article termed to as a
- Unicode escape sequence
- Octal escape
- Line feed
Answer. Unicode escape sequence
4) What one of the following qualifies as a proper char declaration?
- char ch = ‘\utea’;
- char ca = ‘tea’;
- char cr = \u0223;
- char cc = ‘\itea’;
Answer. char ch = ‘\utea’;
6) To locate and correct issues in Java programs, ____ is utilised.
7) Of the following, which is a legitimate long literal?
8) What type of value does the hashCode() method in the Object class return?
9) What is the result of the expression float a = 35 / 0?
- Not a Number
- Run time exception
10) Which of the following tools is used to create HTML-formatted API documentation from source code doc comments?
- javap tool
- Java w command
- Javadoc tool
- Java h command
Answer. Javadoc tool
11) Which of the following statements for a for loop is invalid?
- for ( int i = 99; i >= 0; i / 9 )
- for ( int i = 7; i <= 77; i += 7 )
- for ( int i = 20; i >= 2; – -i )
- for ( int i = 2; i <= 20; i = 2* i )
Answer. for ( int i = 99; i >= 0; i / 9 )
12) Which of the following processes has a local variable with the same name as an instance variable?
- Variable Shadowing
Answer. Variable Shadowing
13) Which statement regarding the anonymous inner class is accurate?
- It has only methods
- Objects can’t be created
- It has a fixed class name
- It has no class name
Answer. It has no class name
14) A _____ is a user interface that has no fields or methods.
- Runnable Interface
- Marker Interface
- Abstract Interface
- CharSequence Interface
Answer. Marker Interface
15) What do you mean by the term nameless objects?
- An item produced through the use of the new keyword.
- A superclass object produced by a subclass.
- An object without having any name but having a reference.
- An object that has no reference.
Answer. An object that has no reference.
16) Which of these classes directly derives from the Throwable class?
- RuntimeException and Error class
- Exception and VirtualMachineError class
- Error and Exception class
- IOException and VirtualMachineError class
Answer. Error and Exception class
17)The Panel class has which of the following as an immediate subclass??
- Applet class
- Window class
- Frame class
- Dialog class
Answer. Applet class
18) Which statement regarding the last keyword is untrue?
- A final method can’t be changed in a subclass.
- A final class cannot be extended.
- A final class cannot extend other classes.
- A final method can be inherited.
Answer. A final class cannot extend other classes.
19) What exactly do you mean by Java chained exceptions?
- Exceptions occurred by the VirtualMachineError
- An exception caused by other exceptions
- Chains of exceptions happen when the debugging data is discarded
- None of the above
Answer. An exception caused by other exceptions
20) What purpose does the intern() method serve?
- It returns the existing string from memory
- In the database, a new string is produced.
- It alters the string that already exists in the database.
- None of the above
Answer. It returns the existing string from memory
21) Which of the following corresponds to a Java reserved keyword?
22) Jar refers for ___ in Java.
- Java Archive Runner
- Java Application Resource
- Java Application Runner
- None of the above
Answer. None of the above
23) To access a package’s functionalities, which term is used?
24) What function does \w serve in a regex?
- Used for a whitespace character
- Used for a non-whitespace character
- Used for a word character
- Used for a non-word character
Answer. Used for a word character
25) Of the following, which is untrue?
- The rt.jar stands for the runtime jar
- It is an optional jar file
- It contains all the compiled class files
- The JVM is aware of all the classes in rt.jar.
Answer. It is an optional jar file
26) Which of these elements is used for the compilation, debugging, and execution of a Java program?
27) Which of these literals can be stored in a variable with the float data type?
28) BigDecimal.ONE: What is it?
a. it is a custom-defined statement
b. it is a wrong statement
c. It is a static variable with a value of 1 on a scale of 0
d. It is a static variable with a value of 1 on a scale of 10.
Answer: It is a static variable with a value of 1 on a scale of 0
29) When an expression contains the data types int, double, long, and float, the entire expression will be converted into one of the following data types:
30) Which of the subsequent operations is applicable to boolean variables?
a) C & B
b) A & D
c) A, B & D
d) A, B & C
Answer: A, B & C
31) Which of these is the proper approach for the subclass B to call the constructor of the superclass A that has no parameters?
32) Which of these Object class methods is capable of cloning an object?
a. Object clone()
c. Object copy()
Answer: Object clone()
33) Which one of these packages includes an abstract keyword?
34) Which of these techniques can be used to turn a String’s whole character set into an array of characters?
a. both getChars() & toCharArray()
b. both charAt() & getChars()
d. all of the mentioned
Answer: both getChars() & toCharArray()
35) In the event where the initiating string is longer than the compared string, what result is returned by the compareTo() function?
a. a value that is greater than 0
b. a value that is less than 0
d. none of the above
Answer: a value that is greater than zero
36) Which one of the following exceptions is thrown by the double-wrapped compareTo() method?
37) What place is the String Pool kept?
b. Java Stack
c. Java Heap
d. Permanent Generation
Answer: Java Heap
38) Which of these HttpResponse class data elements is used to store the response received from a http server?
39) Which of these techniques produces the raw MIME formatted string?
40) Which of these exceptions is thrown by the remover() method:
41) Which of the following contains all exceptions type classes as its superclass?
42) What occurs when we request that two threads with the same priority run simultaneously?
a. Both of the threads will be simultaneously executed
b. Lexically, any one of the threads may be run first.
c. It Depends on the OS
d. There won’t be any thread execution.
Answer: It Depends on the OS
43) Which of these classes is used to read strings and characters from the console into Java?
44) Which of these operations can be used to obtain an object’s run-time information?
c. getinfo of
45) Which of these classes permits the user to specify their own formatting style for times and dates?
46) Which approach is appropriate for an applet’s output of a string?
47) What does the public int start() return?
a. starting with the previous match’s start index
b. the current match’s starting index
c. the input string’s starting index
d. None of the above
Answer: starting with the previous match’s start index
48) Which action variable facilitates the JSP’s inclusion of a file?
49) Maven defines dependencies in the _____ file.
50) Closeable and AutoCloseable are distinguished primarily by the following features:
a) AutoCloseable throws IOException; Closeable throws Exception
b) Closeable is a notion, while AutoCloseable is an implementation of it.
c) AutoCloseable throws Exception; Closeable throws IOException
d) Closeable is an interface, while AutoCloseable is a concrete class.
Answer: AutoCloseable throws Exception; Closeable throws IOException