TRE4 C and C++ Quiz practice set 1

Que: (1). Write the output of the following program: int a[ ] = {1,2,3,} *p;

                            int a[] = {1,2,3,} *p;
                        
A.
C.
B.
D.
E.
Open question page

Que: (2). What will be the output of the following C program?

                            int a[] = {10,20,30,40};
int *p = a;
printf("%d", *(p + 2));
                        
A.
C.
B.
D.
E.
Open question page

Que: (3). Which of the following is equivalent to a[3] in C?

B.
A.
C.
D.
E.
Open question page

Que: (4). What will be the output of the following C program?

                            int a[] = {5,10,15,20,25};
printf("%d", sizeof(a) / sizeof(a[0]));
                        
B.
C.
A.
D.
E.
Open question page

Que: (5). What will be the output of the following C program?

                            int a[] = {11,22,33,44};
int *p = &a[1];
printf("%d", *p);
                        
A.
C.
B.
D.
E.
Open question page

Que: (6). What will be the output of the following C program?

                            int a[] = {10,20,30};
int *p = a;
p++;
printf("%d", *p);
                        
C.
B.
A.
D.
E.
Open question page

Que: (7). What will be the output of the following C program?

                            int a[5] = {1,2};
printf("%d", a[3]);
                        
C.
B.
A.
D.
E.
Open question page

Que: (8). What will be the output of the following C program?

                            int a[] = {2,4,6,8};
int *p = &a[1];
printf("%d", p[2]);
                        
A.
B.
C.
D.
E.
Open question page

Que: (9). What will be the output of the following C program?

                            int a[2][3] = {{1,2,3},{4,5,6}};
printf("%d", *(*(a+1)+2));
                        
A.
C.
B.
D.
E.
Open question page

Que: (10). What will be the output of the following C program?

                            void swap(int *x, int *y) {
    int temp = *x;
    *x = *y;
    *y = temp;
}

int main() {
    int a = 10, b = 20;
    swap(&a, &b);
    printf("%d %d", a, b);
    return 0;
}
                        
C.
A.
B.
D.
E.
Open question page

Que: (11). Which of the following statements about arrays and pointers in C is correct?

C.
B.
A.
D.
E.
Open question page

Que: (12). Assume size of an integer as 4 bytes. What is the output of the above program?

                            #include <stdio.h>

int main()
{
int i = 5, j = 10, k = 15;

```
printf("%d ", sizeof(k /= i + j));

printf("%d", k);

return 0;
```

}
                        
C.
B.
A.
D.
E.
Open question page

Que: (13). Assume that an integer occupies 4 bytes. What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
int x = 10;
printf("%d", sizeof(x));
return 0;
}
                        
B.
C.
A.
D.
E.
Open question page

Que: (14). Assume that an integer occupies 4 bytes. What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
int a[5] = {1, 2, 3, 4, 5};

```
printf("%d", sizeof(a));

return 0;
```

}
                        
B.
A.
C.
D.
E.
Open question page

Que: (15). What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
char c = 'A';
printf("%d", sizeof(c));
return 0;
}
                        
B.
A.
C.
D.
E.
Open question page

Que: (16). What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
int x = 10;

```
printf("%d ", sizeof(x++));

printf("%d", x);

return 0;
```

}
                        
C.
A.
B.
D.
E.
Open question page

Que: (17). What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
int x = 10;
int *p = &x;

```
printf("%d %d", sizeof(x), sizeof(p));

return 0;
```

}
                        
C.
B.
A.
D.
E.
Open question page

Que: (18). Which of the following statements about the sizeof operator in C is correct?

A.
C.
B.
D.
E.
Open question page

Que: (19). What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
int a = 10, b = 20;

```
printf("%d", sizeof(a + b));

return 0;
```

}
                        
B.
C.
A.
D.
E.
Open question page

Que: (20). What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
int i = 5;

```
printf("%d ", sizeof(i++));

printf("%d", i);

return 0;
```

}
                        
B.
A.
C.
D.
E.
Open question page

Que: (21). Assume that an integer occupies 4 bytes. What will be the output of the following C program?

                            #include <stdio.h>

int main()
{
int a[10];

```
printf("%d", sizeof(a) / sizeof(a[0]));

return 0;
```

}
                        
A.
C.
B.
D.
E.
Open question page

Que: (22). Which of the following statements about sizeof and expressions in C is correct?

B.
A.
C.
D.
E.
Open question page

Que: (23). Which of the following is an example of a server-side scripting language commonly used in web applications?

C.
B.
A.
D.
E.
Open question page

Que: (24). Which of the following is primarily used for server-side scripting in web applications?

C.
B.
A.
D.
E.
Open question page

Que: (25). Which of the following is a major difference between client-side and server-side scripting?

C.
B.
A.
D.
E.
Open question page

Que: (26). Which of the following is a common use of server-side scripting?

C.
A.
B.
D.
E.
Open question page

Que: (27). In a typical web application, where is PHP code executed?

C.
B.
A.
D.
E.
Open question page

Que: (28). Which of the following technologies can be used for server-side web application development?

C.
A.
B.
D.
E.
Open question page