Time limit: 0
Quiz-summary
0 of 40 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
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
Information
Programming Essentials in C: Mock Test (CLA) Test Online
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 40 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
- 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
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- Answered
- Review
-
Question 1 of 40
1. Question
1 pointsWhat is the value of the following integer literal?017
Correct
Incorrect
-
Question 2 of 40
2. Question
1 pointsWhat is the value of the following integer literal?0x17
Correct
Incorrect
-
Question 3 of 40
3. Question
1 pointsWhich of the following strings is a valid variable name?Correct
Incorrect
-
Question 4 of 40
4. Question
1 pointsWhich of the following declarations is valid?Correct
Incorrect
-
Question 5 of 40
5. Question
1 pointsWhat is the value of the X variable at the end of the following snippet?int X = 8; X = X - X / 2; X = X * X / 4; X = X + 2 * X;
Correct
Incorrect
-
Question 6 of 40
6. Question
1 pointsWhat is the value of the X variable at the end of the following snippet?float X = 2.0; X = X + X * 4; X = X / X * X; X = X / X + X;
Correct
Incorrect
-
Question 7 of 40
7. Question
1 pointsWhich of the following strings is a proper floating-point number (in the “C” language sense)?Correct
Incorrect
-
Question 8 of 40
8. Question
1 pointsWhat is the value of the Y variable at the end of the following snippet?int X = 1, Y = X + 2, Z = Y++; Z = X / Y * --X * Y--;
Correct
Incorrect
-
Question 9 of 40
9. Question
1 pointsWhat is the value of the X variable at the end of the following snippet?int X; X = ('r' - 's') * ('A' / 'Z');
Correct
Incorrect
-
Question 10 of 40
10. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int x = 1, y = 1; float k = -1e0, m = 2e1; printf("%d\n", (x >= y) + (x >= y) + (k >= y) + (m >= k) + ('q' <= 'z')); return 0; } Correct
Incorrect
-
Question 11 of 40
11. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = 1; if(i = 0) i = 2; else i = 3; printf("%d\n",i); return 0; } Correct
Incorrect
-
Question 12 of 40
12. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = 1, j = 0; do { i *= 2; j += i / 2; } while(j < 1); printf("%d",i + j); return 0; } Correct
Incorrect
-
Question 13 of 40
13. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = 5, j = 16; while(j >= 0) { i /= 2; j -= i / 2; } printf("%d",i + j); return 0; } Correct
Incorrect
-
Question 14 of 40
14. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = 1, j; for(j = 0; j ; j--) i *= 2; printf("%d",i + j); return 0; } Correct
Incorrect
-
Question 15 of 40
15. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = -1, j = 1; for(i++; i++; i++) j++; printf("%d",i + j); return 0; } Correct
Incorrect
-
Question 16 of 40
16. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = 1, j = 0, k; k = (i >> j) + (j >> i) + (i >> i) + (j >> j); k <<= i; printf("%d", k); return 0; } Correct
Incorrect
-
Question 17 of 40
17. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = 3, j = i - 2 * i; switch(i - j) { case 1: j++; case 2: j--; case 0: j++; break; default: j = 0; } printf("%d", ++j); return 0; } Correct
Incorrect
-
Question 18 of 40
18. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i = 5, j = i - 4 * i; switch(j) { default: j = 2; case 1: j--; break; case 2: j++; case 0: j--; break; } printf("%d", j++); return 0; } Correct
Incorrect
-
Question 19 of 40
19. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i, t[4]; for(i = 0; i < 3; i++) { t[i] = 4 - i; t[i + 1] = 2 * t[i]; } printf("%d\n", t[2]); return 0; } Correct
Incorrect
-
Question 20 of 40
20. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { int i, s = 0, t[] = {16, 8, 4, 2, 1, 0}; for(i = 5; t[i] > 2; i /= 2) s += t[i]; printf("%d\n", s); return 0; } Correct
Incorrect
-
Question 21 of 40
21. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { char t[] = { 'x', 'z', 'Y', 'Z', '2' , '0'}; printf("%d\n", t[t[1] - t[0] - t[3] + t[2] + 3] - t[5]); return 0; } Correct
Incorrect
-
Question 22 of 40
22. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { float a = 3.14E0, *b = &a, **c = &b; **c = a + (a == *b); printf("%f", a); return 0; } Correct
Incorrect
-
Question 23 of 40
23. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { char t[4][4]; printf("%d\n",sizeof(t) / sizeof(t[0]) / sizeof(t[0][0])); return 0; } Correct
Incorrect
-
Question 24 of 40
24. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { char *p = "\0\2\1\3\4"; printf("%d\n", p[p[2]] + *(p + 1) + p[0]); return 0; } Correct
Incorrect
-
Question 25 of 40
25. Question
1 pointsWhat happens if you try to compile and run this program?#include
#include int main(void) { char tt[20] = "9081726354"; strcpy(tt, tt + 3); printf("%d\n", strlen(tt) - tt[9] + '5'); return 0; } Correct
Incorrect
-
Question 26 of 40
26. Question
1 pointsWhat happens if you try to compile and run this program?#include
#include int main(void) { char tt[20] = "0123456789"; strcat(tt + 11, "123"); printf("%d\n", strlen(tt) - tt[8] + '0'); return 0; } Correct
Incorrect
-
Question 27 of 40
27. Question
1 pointsWhat happens if you try to compile and run this program?#include
#include int main(void) { float *t = 1 + (float *) malloc(sizeof(float) * sizeof(float)); t--; *t = 8.0; t[1] = *t / 4.0; t++; t[-1] = *t / 2.0; printf("%f\n",*t); free(--t); return 0; } Correct
Incorrect
-
Question 28 of 40
28. Question
1 pointsWhat happens if you try to compile and run this program?#include
#include struct S { char S[8]; }; int main(void) { struct S S = { 'a', 'b', 'c', 'd' }; printf("%d", sizeof(S.S) - strlen(S.S) + S.S[4]); return 0; } Correct
Incorrect
-
Question 29 of 40
29. Question
1 pointsWhat happens if you try to compile and run this program?#include
#include #include struct S { char *S; }; int main(void) { struct S *S = (struct S *) malloc(sizeof(struct S)); S -> S = "123\0""45678"; printf("%d", strlen(S -> S + 5) + S -> S[3]); free(S); return 0; } Correct
Incorrect
-
Question 30 of 40
30. Question
1 pointsWhat happens if you try to compile and run this program?#include
struct S { int Var; struct S *Str; }; int main(void) { struct S S[] = { { 8, NULL }, { 4, &S[0] }, { 2, &S[1] } }; printf("%d", S[2].Str->Str->Var); return 0; } Correct
Incorrect
-
Question 31 of 40
31. Question
1 pointsWhat happens if you try to compile and run this program?#include
int fun(int *t) { return *(t + 3); } int main(void) { int arr[] = { 3, 2, 1, 0 }; printf("%d\n", fun(arr - 2)); return 0; } Correct
Incorrect
-
Question 32 of 40
32. Question
1 pointsWhat happens if you try to compile and run this program?#include
float f(float v) { v = v / 2.0; return v + v; } int main(void) { float x = 4; f(x); printf("%f",x); return 0; } Correct
Incorrect
-
Question 33 of 40
33. Question
1 pointsWhat happens if you try to compile and run this program?#include
char *f(char *p) { return p += 2; } char *g(char *p) { return --p; } int main(void) { char *s = "ABCDEFGHIJ"; char p = *f(g(f(s + 1))); printf("%d",p - 'A'); return 0; } Correct
Incorrect
-
Question 34 of 40
34. Question
1 pointsWhat happens if you try to compile and run this program?#include
struct S { int S[3]; }; void f(struct S S) { S.S[0] = S.S[1] + S.S[2] - 4; } int main(void) { struct S S = { { 1, 4, 2 } }; f(S); printf("%d",S.S[1] * S.S[0]); return 0; } Correct
Incorrect
-
Question 35 of 40
35. Question
1 pointsWhat happens if you try to compile and run this program?#include
struct S { int S[3]; }; void f(struct S *S) { S->S[2] = 6 * S->S[0] + S -> S[1]; } int main(void) { struct S S = { { 1, 2 } }, *P = &S; f(P); printf("%d",S.S[2] / S.S[0]); return 0; } Correct
Incorrect
-
Question 36 of 40
36. Question
1 pointsWhat happens if you try to compile and run this program?#include
#include char *f(int p, char *s) { s[p + 2] = '\0'; return s - 1; } int main(void) { char s[] = "ABCDEF"; int i = strlen(f(1,s + 2)); printf("%d\n",i); return 0; } Correct
Incorrect
-
Question 37 of 40
37. Question
1 pointsWhat happens if you try to compile and run this program?#include
int main(void) { char s[20] = "?"; FILE *f = fopen("fopen","w"); int i = fputs("789",f); fclose(f); f = fopen("fopen","r"); fgets(s + 1,3,f); printf("%c\n", s[2] - s[3]); fclose(f); return 0; } Correct
Incorrect
-
Question 38 of 40
38. Question
1 pointsWhat happens if you try to compile and run this program?#include
#define ONE 1 #define TWO ONE + ONE int main(void) { int i = 2; i = i - 2 * TWO; printf("%d\n", i); return 0; } Correct
Incorrect
-
Question 39 of 40
39. Question
1 pointsSelect the proper form for the following declaration: ptr is a pointer to pointer to pointer to doubleCorrect
Incorrect
-
Question 40 of 40
40. Question
1 pointsWhat is the meaning of the following declaration?float *f(int);
Correct
Incorrect