Quiz on Command Line Arguments in Java
Free Java courses with 37 real-time projects - Learn Java
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
- Question 1 of 15
1. Question
Which of the following is used to have command line arguments in the program ?
CorrectIncorrect - Question 2 of 15
2. Question
class Argument {
public static void main ( String [ ] args )
{
if(args.length==0)
{
System.out.println(“Default argument is passed”);
}
else {
System.out.println(“command line argument is passed”);
}
}
}
What will be the output of the program ?
CorrectIncorrect - Question 3 of 15
3. Question
class CommandLine {
public static void main ( String args [ ] )
{
System.out.println(argc);
}
}
What will be the output of the program ?
CorrectIncorrect - Question 4 of 15
4. Question
Which keyword in Java is used to represent the number of command line arguments ?
CorrectIncorrect - Question 5 of 15
5. Question
class Program {
public static void main ( String args [ ] )
{
if(args.length==argc)
System.out.println(“Length of command line argument length is equal to no of command line arguments);
else {
System.out.println(“Length of command line argument length is not equal to no of command line arguments);
}
}
Command line argument = DataFlair webservices private limited.
What will be the output of the program ?
CorrectIncorrect - Question 6 of 15
6. Question
class Looping {
public static void main ( String args [ ] )
{
for(i=0; i<=args.length;i++)
{
System.out.println(args[i]);
}
}
Command line argument = DataFlair webservices private limited.
What will be the output of the given program ?
CorrectIncorrect - Question 7 of 15
7. Question
Which of the following is the thing used to store command line arguments ?
CorrectIncorrect - Question 8 of 15
8. Question
class Example {
Public static void main ( String args [ ] )
{
System.out.println( argc);
}
}
If the given program is executed with DataFlair as command line argument what will be the output of the program ?
CorrectIncorrect - Question 9 of 15
9. Question
class Exceptions {
public static void main ( String args [ ] )
{
}
public void display()
{
System.out.println(args);
}
}
What will be the output of the program ?
CorrectIncorrect - Question 10 of 15
10. Question
Which of the following is not true about command line arguments ?
CorrectIncorrect - Question 11 of 15
11. Question
class Sample {
public static void main ( String args [ ] )
{
System.out.println(args+args.length);
}
}
If the above program is executed with DataFlair as command line argument what will be the output of the program ?
CorrectIncorrect - Question 12 of 15
12. Question
Which of the following is the correct way to pass command line arguments for the given program ?
class Command {
public static void main ( String args [ ] )
{
System.out.println(args);
}
}
CorrectIncorrect - Question 13 of 15
13. Question
Which of the following is the correct syntax to find the index of the last passed argument ?
CorrectIncorrect - Question 14 of 15
14. Question
class CommandLine {
public static void main ( String args [ ] )
{
System.out.println(args[0]);
}
}
If no command line argument is passed to the program what will be the output of the program ?
CorrectIncorrect - Question 15 of 15
15. Question
class Program {
public static void main ( String args [ ] )
{
System.out.println(args[2]);
}
}
If the above program is executed using java program company DataFlair webservices command line argument what will be the output of the program ?
CorrectIncorrect
Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google