
IT Interview Exam Questions: C Programming 17 (IT Interview Exam Question, IT Campus Placement)
Subject: C Programming 17
Part 17: List for questions and answers of C Language
Q1. The maximum combined length of the command-line arguments including the spaces between adjacent arguments is
a) 128 characters
b) 256 characters
c) 67 characters
d) it may vary from one operating system to another
Q2. According to ansi specifications which is the correct way of declaring main when it receives command-line arguments?
a) int main(int argc, char *argv[])
b) Int main(argc, argv) int argc; char *argv;
c) Int main() { int argc; char *argv; }
d) None of above
Q3. What do the ‘c’ and ‘v’ in argv 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
Q4. What does argv and argc indicate in command-line arguments? (assuming: int main(int argc, char *argv[]) )
a) Argument count, argument variable
b) argument count, argument vector
c) Argument control, argument variable
d) Argument control, argument vector
Q5. Which of the following syntax is correct for command-line arguments?
a) int main(int var, char *varg[])
b) Int main(char *argv[], int argc)
c) Int main() { int argv, char *argc[]; }
d) Both (a) and (b)
Q6. In linux, argv[0] by command-line argument can be occupied by
a) ./a.out
b) ./test
c) ./fun.out.out
d) all of the mentioned
Q7. What type of array is generally generated in command-line argument?
a) Single dimension array
b) 2-dimensional square array
c) jagged array
d) 2-dimensional rectangular array
Q8. The first argument in command line arguments is
a) the number of command-line arguments the program was invoked with;
b) A pointer to an array of character strings that contain the arguments
c) Nothing
d) Both a & b
Q9. The second (argument vector) in command line arguments is
a) The number of command-line arguments the program was invoked with;
b) a pointer to an array of character strings that contain the arguments,one per string
c) Nothing
d) Both a & b
Q10. Argv[0] in command line arguments, is
a) the name by which the program was invoked
b) The name of the files which are passed to the program
c) Count of the arguments in argv[] vector
d) Both a & b
Q11. A program that has no command line arguments will have argc
a) Zero
b) Negative
c) one
d) Two
Q12. The index of the last argument in command line arguments is
a) Argc–2
b) Argc+1
c) Argc
d) argc – 1
Q13. What is the output of this c code (if run with no options or arguments)?
#include <stdio.h>
int main(int argc, char *argv[])
{
printf(“%d\n”, argc);
return 0;
}
a) 0
b) 1
c) Depends on the platform
d) Depends on the compiler
Q14. What is the output of this c code (run without any commandline arguments)?
Int main(int argc, char *argv[]){ while (argc–) printf(“%s\n”, argv[argc]); return 0; }
a) Compile time error
b) executablefilename
c) Segmentation fault
d) Undefined
Q15. What is the output of this c code (run without any commandline arguments)?
#include <stdio.h>
Int main(int argc, char *argv[])
{
printf(“%s\n”, argv[argc]);
return 0;
}
a) segmentation fault/code crash
b) Executable file name
c) Depends on the platform
d) Depends on the compiler
Q16. What is the output of this c code (run without any commandline arguments)?
#include <stdio.h>
Int main(int argc, char *argv[])
{
while (*argv++ != null)
printf(“%s\n”, *argv);
return 0;
}
a) segmentation fault/code crash
b) Executable file name
c) Depends on the platform
d) Depends on the compiler
Q17. The default executable generation on unix for a c program is ___
a) A.exe
b) A
c) a.out
d) Out.a
Q18. In windows & linux, how many bytes exist for near, far and huge pointers?
a) Near: 1, far: 4, huge: 7
b) near: 4, far: 4, huge: 4
c) Near: 0, far: 4, huge: 4
d) Near: 4, far: 5, huge: 6
Q19. Running out of memory may occur due to
a) Non-recursive call
b) recursive function call
c) Use of more extern variable
d) None of these
Q20. Which of the following is not a primitive recursive but partially recursive?
a) Carnot’s function
b) Ricmaan function
c) Both (a) and (b)
d) ackermann’s function
Part 17: List for questions and answers of C Language
Q1. Answer: d
Q2. Answer: a
Q3. Answer: c
Q4. Answer: b
Q5. Answer: a
Q6. Answer: d
Q7. Answer: c
Q8. Answer: a
Q9. Answer: a
Q10. Answer: a
Q11. Answer: c
Q12. Answer: d
Q13. Answer: b
Q14. Answer: b
Q15. Answer: a
Q16. Answer: a
Q17. Answer: c
Q18. Answer: b
Q19. Answer: b
Q20. Answer: d