/
first character of the string constant
complete string
address of the string storage
is a logical error
Consider the following variable declaration
Union x{
int i;
float f;
char c;
}y;
if the size of i, f and c are 2 bytes, 4 bytes and 1 byte respectively then the size of the variable y is:-
1 byte
2 bytes
4 bytes
7 bytes
Pick up the odd one out from the following
x = x – 1
x - = 1
x - -
x = - 1
What is the value of ‘average’ after the following program is executed?
main()
{
int sum, index ;
sum = index = 0 ;
float average;
sum = 0;
for( ; ; ) {
sum = sum + index;
++index;
if (sum >= 100) break ;
}
average = sum / index;
}
91/13
91/14
105/14
105/15
Suppose i, j, k are integer variables with values 1, 2, 3 respectively. What is the value of the following expression?
! (( j + k ) > ( i + 5 ))
6
5
1
0
If a = -11 and b = -3. What is the value of a % b?
- 3
- 2
2
3
If c is a variable initialized to 1, how many times will the following loop be executed?
while(( c > 0 && (c < 60)))
{
c++;
}
61
60
59
1
Which one of the following describes correctly a static variable?
This cannot be initialized.
This is initialized once at the commencement of execution and cannot be changed at run time.
This retains its value through the life of the program.
This is same as an automatic variable but is placed at the head of a program.
What will be the output of the following program?
main()
{
int a, *ptr, b, c;
a = 25;
ptr = &a;
b = a + 30;
c = *ptr;
printf(“%d %d %d”, a, b, c);
}
25, 25, 25
25, 55, 25
25, 25, 55
None of the above
If a = 0(aa and b = a << 1 then which of the following is true
b = a
b = 2a
a = 2b
b = a - 1
In a for loop with a multi statement loop body, semicolons should appear following:
the for statement itself
the crossing brace in the multiple statement loop body
each statement within the loop body and the test expression
each statement within the loop only
When we execute X++; the value of the expression X++ :
is equal to the original value of X
is one more than the original value of X
is X times more than the original value of X
none of the above
An Array’s name is a:
Pointer constant
Pointer variable
Variable name
None of the above
What is printed?
for (i=1; i<=5; )
i++;
printf(“%d”,i)
23456
12345
123456
error
Main()
{
int x = 0;
while(x<=10)
for( ; ; )
if( ++x%10 == 0 )
break;
printf(“x = %d”, x) ;
}
What will be the output of the above program?
Will print x = 10
Will give compilation error
Will give runtime error
Will print x = 20
C uses pointers explicitly with
Arrays
Structures
Functions
All of the above