![]() |
VOOZH | about |
Question 1
The following C declarations
define s to be
An array, each element of which is a pointer to a structure of type node
A structure of 2 fields, each field being a pointer to an array of 10 elements
A structure of 3 fields: an integer, a float, and an array of 10 elements
An array, each element of which is a structure of type node.
Question 2
The value of j at the end of the execution of the following C program.
10
4
6
7
Question 3
Suppose n and p are unsigned int variables in a C program. We wish to set p to nC3. If n is large, which of the following statements is most likely to set p correctly?
p = n * (n-1) * (n-2) / 6;
p = n * (n-1) / 2 * (n-2) / 3;
p = n * (n-1) / 3 * (n-2) / 2;
p = n * (n-1) * (n-2) / 6.0;
Question 4
Consider the following C program:
The number of times printf statement is executed is __________.
8
9
10
11
Question 5
Consider the following C function:
The value returned by f(1) is
5
6
7
8
Question 6
The output of executing the following C program is ________.
# include <stdio.h>
int total(int v)
{
static int count = 0;
while (v) {
count += v & 1;
v >>= 1;
}
return count;
}
void main()
{
static int x = 0;
int i = 5;
for (; i> 0; i--) {
x = x + total(i);
}
printf (ā%d\nā, x) ;
}
23
24
26
27
Question 7
Consider the following C program:
Which one of the following values will be displayed on execution of the programs?
41
52
63
630
There are 7 questions to complete.