C Programming Command Line Arguments Online Test
Finish Quiz
0 of 30 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
Information
C Programming Command Line Arguments Online Test. C Programming Online Question and Answers in English.C Programming Online Quiz. C Programming Command Line Arguments Online mock test paper is free for all students and Very Helpful for Exam Preparation. C Programming Command Line Arguments Online Quiz. C Programming Online Mock test for Command Line Arguments Topic. Here we are providing C Programming Command Line Arguments Online Test Series in English. Check C Programming Mock Test Series 2024-2024.
This paper has 30 questions.
Time allowed is 30 minutes.
The C Programming online Mock Test Exam is Very helpful for all students. Now Scroll down below n click on “Start Quiz” or “Start Test” and Test yourself.
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 have to finish following quiz, to start this quiz:
Results
0 of 30 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- Answered
- Review
-
Question 1 of 30
1. Question
The maximum combined length of the command-line arguments including the spaces between adjacent arguments is
Correct
Incorrect
-
Question 2 of 30
2. Question
What do the ‘c’ and ‘v’ in argv stands for?
Correct
Incorrect
-
Question 3 of 30
3. Question
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three/* myprog.c */ #include<stdio.h> int main(int argc, char **argv) { printf("%c\n", **++argv); return 0; }
Correct
Incorrect
-
Question 4 of 30
4. Question
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three/* myprog.c */ #include<stdio.h> #include<stdlib.h> int main(int argc, char **argv) { printf("%s\n", *++argv); return 0; }
Correct
Incorrect
-
Question 5 of 30
5. Question
What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?
cmd> sample 1 2 3/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { int j; j = argv[1] + argv[2] + argv[3]; printf("%d", j); return 0; }
Correct
Here argv[1], argv[2] and argv[3] are string type. We have to convert the string to integer type before perform arithmetic operation.
Example: j = atoi(argv[1]) + atoi(argv[2]) + atoi(argv[3]);
Incorrect
Here argv[1], argv[2] and argv[3] are string type. We have to convert the string to integer type before perform arithmetic operation.
Example: j = atoi(argv[1]) + atoi(argv[2]) + atoi(argv[3]);
-
Question 6 of 30
6. Question
What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)?
cmd> sample Good Morning/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%d %s", argc, argv[1]); return 0; }
Correct
Incorrect
-
Question 7 of 30
7. Question
What will be the output of the program
#include<stdio.h> void fun(int); int main(int argc) { printf("%d ", argc); fun(argc); return 0; } void fun(int i) { if(i!=4) main(++i); }
Correct
Incorrect
-
Question 8 of 30
8. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample “*.c”/* sample.c */ #include<stdio.h> int main(int argc, int *argv) { int i; for(i=1; i<argc; i++) printf("%s\n", argv[i]); return 0; }
Correct
Incorrect
-
Question 9 of 30
9. Question
What will be the output of the program if it is executed like below?
cmd> sample/* sample.c */ #include<stdio.h> int main(int argc, char **argv) { printf("%s\n", argv[argc-1]); return 0; }
Correct
Incorrect
-
Question 10 of 30
10. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%c", **++argv); return 0; }
Correct
Incorrect
-
Question 11 of 30
11. Question
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog friday tuesday sunday/* myprog.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%c", *++argv[1]); return 0; }
Correct
Incorrect
-
Question 12 of 30
12. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample one two three/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { int i=0; i+=strlen(argv[1]); while(i>0) { printf("%c", argv[1][--i]); } return 0; }
Correct
Incorrect
-
Question 13 of 30
13. Question
What will be the output of the program in Turbo C?
#include<stdio.h> int main(int argc, char *argv, char *env[]) { int i; for(i=1; i<argc; i++) printf("%s\n", env[i]); return 0; }
Correct
Incorrect
-
Question 14 of 30
14. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample Jan Feb Mar/* sample.c */ #include<stdio.h> #include<dos.h> int main(int arc, char *arv[]) { int i; for(i=1; i<_argc; i++) printf("%s ", _argv[i]); return 0; }
Correct
Incorrect
-
Question 15 of 30
15. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample monday tuesday wednesday thursday/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { while(--argc>0) printf("%s", *++argv); return 0; }
Correct
Incorrect
-
Question 16 of 30
16. Question
If the following program (myproc.c) is present in the directory “C:\TC” then what will be output of the program if run it from DOS shell?
/* myproc.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%s", argv[0]); return 0; }
Correct
In order to execute it from DOS shell, we have to run the created EXE file by entering the exe file name as C:\TC>myproc <enter>.
Incorrect
In order to execute it from DOS shell, we have to run the created EXE file by entering the exe file name as C:\TC>myproc <enter>.
-
Question 17 of 30
17. Question
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three/* myprog.c */ #include<stdio.h> int main(int argc, char *argv[]) { int i; for(i=1; i<argc; i++) printf("%c", argv[i][0]); return 0; }
Correct
Incorrect
-
Question 18 of 30
18. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample 1 2 3
cmd> sample 2 2 3
cmd> sample 3 2 3/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%s\n", argv[0]); return 0; }
Correct
Incorrect
-
Question 19 of 30
19. Question
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 1 2 3/* myprog.c */ #include<stdio.h> #include<stdlib.h> int main(int argc, char **argv) { int i, j=0; for(i=0; i<argc; i++) j = j+atoi(argv[i]); printf("%d\n", j); return 0; }
Correct
Incorrect
-
Question 20 of 30
20. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday/* sample.c */ #include<stdio.h> int main(int sizeofargv, char *argv[]) { while(sizeofargv) printf("%s", argv[--sizeofargv]); return 0; }
Correct
Incorrect
-
Question 21 of 30
21. Question
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday/* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%c", *++argv[2] ); return 0; }
Correct
Incorrect
-
Question 22 of 30
22. Question
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 10 20 30/* myprog.c */ #include<stdio.h> int main(int argc, char **argv) { int i; for(i=0; i<argc; i++) printf("%s\n", argv[i]); return 0; }
Correct
Incorrect
-
Question 23 of 30
23. Question
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three/* myprog.c */ #include<stdio.h> #include<stdlib.h> int main(int argc, char **argv) { int i; for(i=1; i<=3; i++) printf("%u\n", &argv[i]); return 0; }
If the first value printed by the above program is 65517, what will be the rest of output?
Correct
Incorrect
-
Question 24 of 30
24. Question
Which of the following is TRUE about argv?
Correct
Incorrect
-
Question 25 of 30
25. Question
Every time we supply new set of values to the program at command prompt, we need to recompile the program.
Correct
Incorrect
-
Question 26 of 30
26. Question
Even if integer/float arguments are supplied at command prompt they are treated as strings.
Correct
Incorrect
-
Question 27 of 30
27. Question
The first argument to be supplied at command-line must always be count of total arguments.
Correct
Incorrect
-
Question 28 of 30
28. Question
In Turbo C/C++ under DOS if we want that any wild card characters in the command-line arguments should be appropriately expanded, are we required to make any special provision?
Correct
Yes you have to compile a program like
tcc myprog wildargs.objIncorrect
Yes you have to compile a program like
tcc myprog wildargs.obj -
Question 29 of 30
29. Question
If the different command line arguments are supplied at different times would the output of the following program change?
#include<stdio.h> int main(int argc, char **argv) { printf("%d\n", argv[argc]); return 0; }
Correct
Incorrect
-
Question 30 of 30
30. Question
Does there exist any way to make the command-line arguments available to other functions without passing them as arguments to the function?
Correct
Using the predefined variables _argc, _argv. This is a compiler dependent feature. It works in TC/TC++ but not in gcc and visual studio.
Incorrect
Using the predefined variables _argc, _argv. This is a compiler dependent feature. It works in TC/TC++ but not in gcc and visual studio.