1. What happens if you try to compile and run this program?
void f(void) { } int main(void) { int i; i = f(); printf("%d",i); return 0; }
- the program outputs nul
- compilation fails
- the program outputs NULL
- the program outputs 0
2. What happens if you try to compile and run this program?
#include <stdio.h> int f(void) { } int main(void) { int i; i = f(); printf("%d",i); return 0; }
- the program outputs NULL
- the program outputs an unpredictable value
- the compilation fails
- the program outputs 0
3. What happens if you try to compile and run this program?
#include <stdio.h> void f(int i) { i++; } int main(void) { int i = 1; f(i); printf("%d",i); return 0; }
- the program outputs 1
- the compilation fails
- the program outputs an unpredictable value
- the program outputs 2
4. What happens if you try to compile and run this program?
#include <stdio.h> int f(int i) { ++i; return i; } int main(void) { int i = 1; i = f(i); printf("%d",i); return 0; }
- the compilation fails
- the program outputs an unpredictable value
- the program outputs 1
- the program outputs 2
5. What happens if you try to compile and run this program?
#include <stdio.h> int f(int i) { return ++i; } int main(void) { int i = 0; i = f(f(i)); printf("%d",i); return 0; }
- the program outputs 2
- the program outputs 0
- the program outputs 1
- the compilation fails
6. What happens if you try to compile and run this program?
#include <stdio.h> int main(void) { int i = 0; { int i = 1; main.i = i; } printf("%d",i); return 0; }
- the program outputs 2
- the program outputs 0
- compilations fails
- the program outputs 1
7. What happens if you try to compile and run this program?
#include <stdio.h> int i = 0; void f(void) { int i = 1; } int main(void) { int i = 2; f(); printf("%d",i); return 0; }
- the compilation fails
- the program outputs 0
- the program outputs 2
- the program outputs 1
8. What happens if you try to compile and run this program?
#include <stdio.h> int i = 0; void f(void) { int i = 1; } int main(void) { f(); printf("%d",i); return 0; }
- the program outputs 1
- the compilation fails
- the program outputs 2
- the program outputs 0
9. What happens if you try to compile and run this program?
#include <stdio.h> int i = 1; int *f(void) { return &i; } int main(void) { int i = 0; i = *f(); printf("%d",i); return 0; }
- the program outputs 0
- the compilation fails
- the program outputs 1
- the program outputs 2
10. What happens if you try to compile and run this program?
#include <stdio.h> int i = 2; int *f(void) { return &i; } int main(void) { int *i; i = f(); printf("%d",++(*i)); return 0; }
- the program outputs 3
- the program outputs 2
- the program outputs 1
- the compilation fails
11. What happens if you try to compile and run this program?
#include <stdio.h> int i = 0; int *f(int *i) { (*i)++; return i; } int main(void) { int i = 1; i = *f(&i); printf("%d",i); return 0; }
- the program outputs 2
- the compilation fails
- the program outputs 1
- the program outputs 0
12. What happens if you try to compile and run this program?
#include <stdio.h> struct S { int S; }; int f(struct S s) { return --s.S; } int main(void) { int i; struct S S = { 2 }; i = f(S); printf("%d",i); return 0; }
- the program outputs 0
- the program outputs 1
- the program outputs 2
- the compilation fails
13. What happens if you try to compile and run this program?
#include <stdio.h> struct S { int S; }; int f(struct S *s) { return --s.S; } int main(void) { int i; struct S S = { 2 }; i = f(S); printf("%d",i); return 0; }
- the program outputs 2
- compilation fails
- the program outputs 0
- the program outputs 1
14. What happens if you try to compile and run this program?
#include <stdio.h> int f(int t[\]) { return t[0\] + t[2\]; } int main(void) { int i,a[\] = { -2,-1,0,1,2 }; i = f(a + 2); printf("%d",i); return 0; }
- the compilation fails
- the program outputs 0
- the program outputs 2
- the program outputs 1
15. What happens if you try to compile and run this program?
#include <stdio.h> int f(int t[\][\]) { return t[0\][0\] + t[1\][0\]; } int main(void) { int i,a[2\][2\] = { {-2,-1},{1,2} }; i = f(a + 2); printf("%d",i); return 0; }
- the program outputs 0
- the program outputs 1
- the program outputs 2
- the compilation fails
16. What happens if you try to compile and run this program?
#include <stdio.h> int f(int t[2\][\]) { return t[0\][0\] + t[1\][0\]; } int main(void) { int i,a[2\][2\] = { {-2,-1},{1,2} }; i = f(a + 2); printf("%d",i); return 0; }
- the program outputs 2
- the program outputs 0
- the program outputs 1
- the compilation fails
17. What happens if you try to compile and run this program?
#include <stdio.h> int f(char t[\]) { return t[1\] - t[0\]; } int main(void) { int i = 2; i -= f("ABDGK" + 1); printf("%d",i); return 0; }
- the program outputs 2
- the program outputs 1
- the program outputs 0
- the compilation fails
18. What happens if you try to compile and run this program?
#include <stdio.h> int f(char t[\]) { return t[0\] - t[-1\]; } int main(void) { int i = 2; i -= f("ABDGK" + 1); printf("%d",i); return 0; }
- the compilation fails
- the program outputs 2
- the program outputs 1
- the program outputs 0
19. What happens if you try to compile and run this program?
#include <stdio.h> #include <string.h> void f(char *s,int i) { *(s + i) = '\0'; } int main(void) { char a[\] = { 'a','b','c','d' }; f(a[1\],1); printf("%d",strlen(a)); return 0; }
- the program outputs 2
- the compilation fails
- the program outputs 1
- the program outputs 0
20. What happens if you try to compile and run this program?
#include <stdio.h> #include <string.h> void f(char *s,int i) { *(s + i) = '\0'; } int main(void) { char a[\] = { 'a','b','c','d' }; f(a+1,1); printf("%d",strlen(a)); return 0; }
- the program outputs 1
- the compilation fails
- the program outputs 2
- the program outputs 0
quiz answers are not available which is been asked after completion of module
Answer plzz
are you solving Cisco c programming course test ?
me too.