

MCQOPTIONS
Saved Bookmarks
This section includes 83 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> cmd> cmd> |
A. | sample 3 2 3 |
B. | sample 1 2 3 |
C. | sample |
D. | Error |
Answer» D. Error | |
2. |
What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> |
A. | 65525 65531 |
B. | 65519 65521 |
C. | 65517 65517 |
D. | 65521 65525 |
Answer» C. 65517 65517 | |
3. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> |
A. | *.c |
B. | "*.c" |
C. | sample *.c |
D. | List of all files and folders in the current directory |
Answer» B. "*.c" | |
4. |
What will be the output of the program if it is executed like below? cmd> |
A. | 0 |
B. | sample |
C. | samp |
D. | No output |
Answer» C. samp | |
5. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> |
A. | three two one |
B. | owt |
C. | eno |
D. | eerht |
Answer» D. eerht | |
6. |
Which of the following is TRUE about ? |
A. | It is an array of character pointers |
B. | It is a pointer to an array of character pointers |
C. | It is an array of strings |
D. | None of above |
Answer» B. It is a pointer to an array of character pointers | |
7. |
What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> |
A. | myprog |
B. | one |
C. | two |
D. | three |
Answer» C. two | |
8. |
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> |
A. | 6 |
B. | sample 6 |
C. | Error |
D. | Garbage value |
Answer» D. Garbage value | |
9. |
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> |
A. | 3 Good |
B. | 2 Good |
C. | Good Morning |
D. | 3 Morning |
Answer» B. 2 Good | |
10. |
If the different command line arguments are supplied at different times would the output of the following program change? |
A. | Yes |
B. | No |
Answer» C. | |
11. |
According to ANSI specifications which is the correct way of declaring when it receives command-line arguments? |
A. | None of above |
Answer» B. | |
12. |
What do the 'c' and 'v' in stands for? |
A. | 'c' means argument control 'v' means argument vector |
B. | 'c' means argument count 'v' means argument vertex |
C. | 'c' means argument count 'v' means argument vector |
D. | 'c' means argument configuration 'v' means argument visibility |
Answer» D. 'c' means argument configuration 'v' means argument visibility | |
13. |
What will be the output of the following C statement? (assuming the input is Welcome to Interview mania )
|
A. | Interview |
B. | mania |
C. | Segmentation Fault |
D. | (null) |
E. | None of these |
Answer» E. None of these | |
14. |
What will be the output of the following C code (run without any command line arguments)?
|
A. | Compilation Error |
B. | Segmentation fault |
C. | Undefined behaviour |
D. | Nothing |
E. | main |
Answer» F. | |
15. |
What will be the output of the following C code (if run with no options or arguments)?
|
A. | Depends on the compiler |
B. | Nothing |
C. | 0 |
D. | 1 |
E. | None of these |
Answer» E. None of these | |
16. |
What will be the output of the following C code (run without any command line arguments)?
|
A. | Executable file name |
B. | Depends on the platform |
C. | Depends on the compiler |
D. | Segmentation fault/code crash |
E. | None of these |
Answer» E. None of these | |
17. |
What will be the output of the following C code (run without any command line arguments)?
|
A. | Executable file name |
B. | Depends on the compiler |
C. | Nothing |
D. | Segmentation fault/code crash |
E. | None of these |
Answer» B. Depends on the compiler | |
18. |
What will be the output of the following C code (run without any command line arguments)?
|
A. | Depends on compiler |
B. | Segmentation fault/code crash |
C. | Executable file name |
D. | Nothing |
E. | None of these |
Answer» C. Executable file name | |
19. |
What will be the output of the following C code (run without any command line arguments)?
|
A. | Depends on compiler |
B. | Compilation Error |
C. | Executable file name |
D. | Segmentation fault/code crash |
E. | None of these |
Answer» E. None of these | |
20. |
What will be the output of the program (sample.c) given below if it is executed from the command line?_x000D_
cmd> sample "*.c"_x000D_
/* sample.c */_x000D_
#include |
A. | *.c |
B. | "*.c" |
C. | sample *.c |
D. | List of all files and folders in the current directory |
Answer» B. "*.c" | |
21. |
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
|
A. | 65525 65531 |
B. | 65519 65521 |
C. | 65517 65517 |
D. | 65521 65525 |
Answer» C. 65517 65517 | |
22. |
What will be the output of the program if it is executed like below?_x000D_
cmd> sample_x000D_
/* sample.c */_x000D_
#include
|
A. | 0 |
B. | sample |
C. | samp |
D. | No output |
Answer» C. samp | |
23. |
Which of the following is correct to interpret Hello World as a single argument? |
A. | Only 1 |
B. | Only 2 |
C. | Both 1 and 2 |
D. | Neither 1 nor 2View Answer |
Answer» D. Neither 1 nor 2View Answer | |
24. |
Which is the correct way of handling arguments with spaces? |
A. | Use single quotes |
B. | Either single or double quotes |
C. | Use double quotes |
D. | There is no way of handling arguments with space |
Answer» C. Use double quotes | |
25. |
Which character is used to separate different arguments? |
A. | # |
B. | $ |
C. | space |
D. | | |
Answer» D. | | |
26. |
Which of the following gives the name of the program if the second parameter to the main fucntion is char **argv? |
A. | argv[3] |
B. | argv[1] |
C. | argv[0] |
D. | argv[2] |
Answer» D. argv[2] | |
27. |
Which of the following is correct about the second parameter of the main function? |
A. | Second parameter is an array of character pointers |
B. | First string of the list is the name of the program’s output fle |
C. | The string in the list are separated by space in the terminal |
D. | All of the mentioned |
Answer» E. | |
28. |
Which of the following is correct about the first parameter of the main function? |
A. | First argument is of int type |
B. | Stores the count of command line arguments |
C. | First argument is non-negative |
D. | All of the mentioned |
Answer» E. | |
29. |
What does the second parameter of the main function represent? |
A. | Number of command line arguments |
B. | List of command line arguments |
C. | Dictionary of command line arguments |
D. | Stack of command line arguments |
Answer» C. Dictionary of command line arguments | |
30. |
What does the first parameter of the main function represent? |
A. | Number of command line arguments |
B. | List of command line arguments |
C. | Dictionary of command line arguments |
D. | Stack of command line arguments |
Answer» B. List of command line arguments | |
31. |
What is the signature of math in function using command line arguments? |
A. | int main(int argc, char const *argv[]); |
B. | int main(int argc, char const **argv); |
C. | int main(int argc, char **argv); |
D. | all of the mentioned |
Answer» E. | |
32. |
To use command line arguments in C++, how many parameters are passed to the main function? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 | |
33. |
What are command line arguments? |
A. | Arguments passed to main() function |
B. | Arguments passed to any function |
C. | Arguments passed to class functions |
D. | Arguments passed to structure functions |
Answer» B. Arguments passed to any function | |
34. |
Which are the methods used to parse string values to the respective data types in Java? |
A. | Boolean.parseBoolean(), Byte.parseByte() |
B. | Integer.parseInt(), Long.parseLong() |
C. | Float.parseFloat(), Double.parseDouble() |
D. | All the above |
Answer» E. | |
35. |
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. |
A. | TRUE |
B. | FALSE |
C. | - |
D. | - |
Answer» B. FALSE | |
36. |
Which is the exception or error that is thrown if a non-existing command-line argument is referred to in a Java program? |
A. | StackOverflowError |
B. | IndexOutOfBoundsException |
C. | ArrayIndexOutOfBoundsException |
D. | ArithmeticException |
Answer» D. ArithmeticException | |
37. |
Choose the correct way of receiving command-line arguments with in the MAIN method in Java? |
A. | public static void main(String[] args) |
B. | public static void main(String args[]) |
C. | public static void main(String anyName[]) |
D. | All the above. |
Answer» E. | |
38. |
To pass a string as a command-line argument in Java, you need to surround the text within a pair of ___. |
A. | Single Quotes ('abc def') |
B. | Double Quotes ("abc def") |
C. | Double Spaces( abc def ) |
D. | Triple Single Quotes ('''abc def''') |
Answer» C. Double Spaces( abc def ) | |
39. |
Is there any limit to the number of spaces between two arguments of command-line arguments in Java? |
A. | Yes |
B. | No |
C. | - |
D. | - |
Answer» C. - | |
40. |
What is the output of the below Java program with command-line arguments? |
A. | car brake horn |
B. | car |
C. | horn brake car |
D. | horn |
Answer» C. horn brake car | |
41. |
Can you pass a sentence with multiple words separated by spaces as a single command-line argument in Java? |
A. | Yes |
B. | No |
C. | - |
D. | - |
Answer» B. No | |
42. |
The delimiter used to separate command-line arguments in Java is ____. |
A. | Semicolon (;) |
B. | Colon (:) |
C. | Space |
D. | Comman (,) |
Answer» D. Comman (,) | |
43. |
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 |
Answer» E. | |
44. |
The type of Arguments the MAIN method accepts is ___. |
A. | Integer[] |
B. | Float[] |
C. | Long[] |
D. | String[] |
Answer» E. | |
45. |
The command-line arguments in Java are used along with a ____ command. |
A. | javac |
B. | java or javaw |
C. | javap |
D. | All the above |
Answer» C. javap | |
46. |
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 |
Answer» C. display() method | |
47. |
If you need to accept data at runtime, you use ___ in Java. |
A. | Command-line arguments |
B. | Java IO statements |
C. | - |
D. | - |
Answer» C. - | |
48. |
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 |
Answer» B. 8 | |
49. |
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 |
Answer» C. the time of compiling a Java program. | |
50. |
Command-line arguments help in a way of ____ data to a program. |
A. | Inputting |
B. | Outputting |
C. | - |
D. | - |
Answer» B. Outputting | |