MCQOPTIONS
Saved Bookmarks
This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
6. What will be output of following program? #include int main(){ int a = 10; void *p = &a; int *ptr = p; printf("%u",*ptr); return 0; } |
| A. | 10 |
| B. | Address |
| C. | 2 |
| D. | Compilation error |
| Answer» B. Address | |
| 2. |
Consider the following C program segment: char p[20]; char *s = "string"; int length = strlen(s); int i; for (i = 0; i < length; i++) p[i] = s[length — i]; printf("%s", p); The output of the program is? |
| A. | gnirts |
| B. | Gnirt |
| C. | String |
| D. | no output is printed |
| Answer» E. | |
| 3. |
What is the output of the following program? #include intfuncf (int x); intfuncg (int y); main() { int x = 5, y = 10, count; for (count = 1; count < = 2; ++count) { y + = funcf (x) + funcg(x); printf(«%d",y); } }funcf(int x) { inty; y = funcg(g); return (y); } funcg(int x) { staticint y = 10; y + = l; return (y + x); |
| A. | 43 80 |
| B. | 42 74 |
| C. | 33 37 |
| D. | 32 32 |
| Answer» B. 42 74 | |
| 4. |
Consider the C program shown below #include #define print(x) printf("%d", x) int x; void Q(int z) { z+=x; print(z); } void P(int *y) { int x = *y + 2; Q(x); *y = x - 1; print(x); } main(void) { x = 5; P(&x); print(x); } The output of this program is |
| A. | 12 7 6 |
| B. | 22 12 11 |
| C. | 14 6 6 |
| D. | 7 6 6 |
| Answer» B. 22 12 11 | |
| 5. |
Assume the following C variable declaration int *A[10], B[10][10]; Of the following expressions |
| A. | A[2] |
| B. | A[2][3] |
| C. | B[1] |
| D. | B[2][3] |
| Answer» B. A[2][3] | |