![]() |
VOOZH | about |
Question 1
Consider the following C program.
The output of this program is:
0, c
0, a+2
'0', 'a+2'
'0', 'c'
Question 2
Consider the following C program
The output is
19
18
20
3
Question 3
Consider the following C program:
The output of the program above is
Hi Bye Bye Hi
Hi Bye Hi Bye
Bye Hi Hi Bye
Bye Hi Bye Hi
Question 4
What does the following program print?
2 2
2 1
0 1
0 2
Question 5
What is printed by the following ANSI C program?
#include<stdio.h>
int main(int argc, char *argv[])
{
int x = 1, z[2] = {10, 11};
int *p = NULL;
p = &x;
*p = 10;
p = &z[1];
*(&z[0] + 1) += 3;
printf("%d, %d, %d\n", x, z[0], z[1]);
return 0;
}
1, 10, 11
1, 10, 14
10, 14, 11
10, 10, 14
Question 6
Consider the following function implemented in C:
void printxy(int x, int y)
{
int *ptr;
x = 0;
ptr = &x;
y = *ptr;
*ptr = 1;
printf("%d,%d", x, y);
}
The output of the printxy(1,1) is
0,0
0,1
1,0
1,1
Question 7
Consider the C program shown below.
The output of this program is
12 7 6
22 12 11
14 6 6
7 6 6
Question 8
What does the following C-statement declare? [1 mark]
A function that takes an integer pointer as argument and returns an integer.
A function that takes an integer as argument and returns an integer pointer.
A pointer to a function that takes an integer pointer as argument and returns an integer.
A function that takes an integer pointer as argument and returns a function pointer
Question 9
Consider the following C program segment.
What will be printed by the program?
12
120400
1204
1034
Question 10
Consider the following C program.
Which one of the following expressions, when placed in the blank above, will NOT result in a type checking error?
f(s, *s)
i = f(i,s)
f(i,*s)
f(i,*p)
There are 28 questions to complete.