java multiple choice question
By Team Alpha | Computer | Mar 29, 2018

- Which is valid declaration of a float?
- float f = 1F;
- float f = "1";
- float f = 1.0d;
- float f = 1.0;
Ans a. (float f = 1F;)
- /* Missing Statement ? */
public class too
{
public static void main(String[]args)throws Exception
{
java.io.PrintWriter out = new java.io.PrintWriter();
new java.io.OutputStreamWriter(System.out,true);
out.println("Hello Word");
}
}
Which line of code should replace the missing statement to make this program compile?
- port java.io.PrintWriter;
- import java.io.*;
- include java.io.*;
- No statement required.
Ans d.( No statement required.)
- What is the name of the method used to start thread execution?
- start();
- resume();
- init();
- run();
Ans a. (start();)
- Which cannot directly cause a thread to stop executing?
- Calling notify() method on an object.
- Calling the wait() method on an object.
- Calling read() method on an InputStream object.
- Calling the SetPriority() method on a Thread object.
Ans a.( Calling notify() method on an object.)
- Which of the following will directly stop execution of Thread?
- exits synchronized code
- notifyall()
- wait()
- notify()
Ans d. (notify())
- What method must be defined by class implementing the java.lang.Runnable interface?
- public void run()
- void run(int priority)
- public void start()
- void run()
Ans a.( public void run())
- Which method registers a thread in a thread scheduler?
- register();
- start();
- run();
- construct();
Ans b. (start();)
- Which symbol is used to denote a multi-line comment?
- < >
- / /
- { }
- /* */
Ans d.(/* */)
- What allows the programmer to destroy an object x?
- delete()
- Only the garbage collection system can destroy an object.
- getRuntime().gc()
- finalize()
Ans b. (Only the garbage collection system can destroy an object.)
- Which of the following is not a Java keyword?
- of
- Default
- Volatile
- For
Ans a.(of)
- Which symboolare used to terminates every line of code in Java.
- )
- }
- .
- ;
Ans d.(;)
- Which command used to compile Java program in the command prompt.
- Jav
- Jav
- Javac
- java
Ans d.(java)
- It is the process of removing errors found in the program.
- Running
- Compiling
- Debugging
- Editing
Ans c.(Debugging)
- _ is a form of Java program that runs locally on the command line.
- Applets
- Application
- Servlets
- Midlets
Ans b.(Application)
- Which of the following is the data type used for a single character?
- Short
- Char
- Byte
- Long
Ans b.(Char)
- What do you mean infinite loop?
- A loop that functions infinitely well
- A loop that will never function
- A loop that never starts
- A loop that runs forever
Ans d.(A loop that runs forever)
- Which symbol is used to denote a multi-line comment?
- < >
- / /
- { }
- /* */
Ans b.(//)
- Java Compiler:
- Produces java Interpreter
- Creates classes
- Creates executable
- It translates java source code to byte code
Ans d.( It translates java source code to byte code)
- Order of three top level elements of the java source file are
- Package ,Import, Class
- Class , Import , Package
- Random order
- Import , Class , Package
Ans a.( Package ,Import, Class)
- Which code is use in java to represent the character?
- Unicode
- Byte Code
- ASCII code
- None of the above
Ans a. (Unicode)
Share this Post
(इस पोस्ट को अपने दोस्तों के साथ शेयर करना ना भूले)Posts in Other Categories
Latest Posts
ICAI CA Final Result Date September 2025: Latest ...
Oct 08, 2025
BAL GANGADHAR TILAK BIOGRAPHY
Jul 05, 2025