Question
4. For the following questions, choose the corret answer. (a) Given the following C code: #include #include int main(int argc, char **argv) { argc--; for(int
4. For the following questions, choose the corret answer.
(a) Given the following C code:
#include
#include
int main(int argc, char **argv) {
argc--;
for(int i = 0; i < argc; i++) {
printf("%s ", argv[i]); }
return 0; }
Which output will be displayed if executed as follows:
./a.out Doctor Who?
A. Doctor Who?
B. Doctor C. a.out Doctor
D. ./a.out Doctor
E. ./a.out Doctor Who?
F. None of the above
(b) What would be the output of the following piece of C code? Assume that the rest of the code is valid (i.e., proper headers have been included, variables have already been properly declared, and the code compiles, etc.)
i = 3;
j = 4;
i = (i == j) ? 5: 7;
printf("i is now %d ", i);
A. i is now 1
B. i is now 3
C. i is now 4
D. i is now 5
E. i is now 7
F. None of the above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started