TOTAL QS = 20Time [ 00 : 00 : 00 ]
00:00:00

Java Command Line Arguments Basics Online Test 1

Instructions

Total Questions: 20

Total Minutes: 20

This ExamTray Free Online Test or Quiz or Trivia tests your Programming Skills on basics of Java Command Line Arguments. This test displays answers after finishing the exam for review. You can easily clear Competitive Exams and Job Interview Questions. Students can learn Java basics.

Go through Java Theory Notes on Command Line Arguments before attempting this test.

All the Best

Challenge SCORE

0 / 20

Take This Exam
1) A command-line argument in Java is a value passed at the time of ___ a program.
2) Command-line arguments help in a way of ____ data to a program.
3) The command-line arguments are passes at ____.
4) When a Java program is executed once, how many times can you pass data using the Command-line arguments?
5) If you need to accept data at runtime, you use ___ in Java.
6) Which is the method that accepts data passed in the form of command-line arguments in Java?
7) The command-line arguments in Java are used along with a ____ command.
8) The type of Arguments the MAIN method accepts is ___.
9) The data that is passed at the time of running a Java program as command-line arguments are converted into ___ data type.
10) The delimiter used to separate command-line arguments in Java is ____.
11) Can you pass a sentence with multiple words separated by spaces as a single command-line argument in Java?
12) What is the output of the below Java program with command-line arguments?
public class CommandLineArgs1
{
  public static void main(String[] args)
  {
    for(String str: args)
    {
      System.out.println(str);
    }
    if(args.length == 0)
      System.out.println("No arguments passed");
}
c:\folder>java CommandLineArgs1 car brake horn
13) Is there any limit to the number of spaces between two arguments of command-line arguments in Java?
14) To pass a string as a command-line argument in Java, you need to surround the text within a pair of ___.
15) Choose the correct way of receiving command-line arguments with in the MAIN method in Java?
16) what is the output of the below Java program with command-line arguments?
public class CommandLineArguments2
{
  public static void main(String[] args)
  {
    System.out.println(args[1]);
  }
}

C:\folder>java CommandLineArguments2 TIGER
17) Which is the exception or error that is thrown if a non-existing command-line argument is referred to in a Java program?
18) Any type of data that can be typed on a console or ECLIPSE can be passed as a command-line argument. State TRUE or FALSE.
19) Which are the methods used to parse string values to the respective data types in Java?
20) What is the output of the below Java program?
public class CommandLineArguments3
{
  public static void main(String[] args)
  {
    String name = args[0];
    int age = Integer.parseInt(args[1]);
    Boolean married = Boolean.parseBoolean(args[2]);
    Float salary = Float.parseFloat(args[3]);
    System.out.println("Name="+name + ", Age=" + age + ", Married=" + married + ", Salary=$"+ salary);
  }
}

C:\folder>java CommandLineArguments3 Marker 25 false 5025.35

Open Certification Helper Popup Reset Popup