Test Series - java

Test Number 56/64

Q: A command-line argument in Java is a value passed at the time of ___ a program.
A. Compiling
B. Running
C. -
D. -
Solution: Yes, Command-line arguments are passed at the time of running.
Q: Command-line arguments help in a way of ____ data to a program.
A. Inputting
B. Outputting
C. -
D. -
Solution: Inputting is nothing but supplying data to a program.
Q: The command-line arguments are passes at ____.
A. Runtime
B. the time of executing a Java program.
C. the time of compiling a Java program.
D. None
Solution: "Runtime" is different from the "time of running a program". Runtime is dynamic.
Q: When a Java program is executed once, how many times can you pass data using the Command-line arguments?
A. 1
B. 8
C. 16
D. None
Solution: Only once.
Q: If you need to accept data at runtime, you use ___ in Java.
A. Command-line arguments
B. Java IO statements
C. -
D. -
Solution: Java IO statements are Input-Output statements which are part of java.io.* package.
Q: Which is the method that accepts data passed in the form of command-line arguments in Java?
A. show() method
B. main() method
C. display() method
D. print() method
Solution: Command-line arguments are useful only when you are using and depending on a MAIN() method.
Q: The command-line arguments in Java are used along with a ____ command.
A. javac
B. java or javaw
C. javap
D. All the above
Solution: You can actually pass string type data with java or javaw command only.
Q: The type of Arguments the MAIN method accepts is ___.
A. Integer[]
B. Float[]
C. Long[]
D. String[]
Solution: Yes. The main method accepts String array data.
Q: The data that is passed at the time of running a Java program as command-line arguments are converted into ___ data type.
A.  Integer array
B. Float array
C. Character array
D. String array
Solution: Any type of data that can be typed in command prompt as command-line arguments are converted finally into a String array.
Q: The delimiter used to separate command-line arguments in Java is ____.
A. Semicolon (;)
B. Colon (:)
C. Space
D. Comman (,)
Solution: -

You Have Score    /10