You are on page 1of 12

1......

result = f (x) * f (x); {

char *str = " 01234 "; printf("%d", x); int temp;

while( *str ! = NULL && } temp = a ;


printf("%d\n", *str++));
a=b;
Char inchar = 'A';
3....... b = temp ;
Switch ( inchar )
int ( * f) (int * ) ; }
{
A function In order to exchange the
case 'A' : printf ("Choice A\ n that takes an integer values of two variables x and
") ; pointer as argument y
and returns an
case 'B' : call swap (x,
integer
case 'C' : printf ("Choice B"); y)

case 'D' :
A function
case 'E' : call swap
that takes an integer
(&x, &y)
default : printf ( " No as argument and
Choice" ); returns an integer
pointer
} swap (x, y)
cannot be used as it
does not return any
A pointer to
2....... a function that takes value
an integer pointer as
int x, result;
argument and
int f (int x) Returns an integer. swap (x, y)
cannot be used as
{ the parameters are
passed by value
x = x + 1; A function
that takes an integer
return x; pointer as argument
and returns a 5.....
}
function pointer
Function------------- reads a
void main ()
line from a specified file.
{ Function ------ writes a line to
4....... specified file.
x = 2;
void swap (int a, int b)
fgetc, fputc {

7...... int c= - - 2;
fgets, fputs
main( ) printf("c=%d",c) ;
fputs, fgets
{ }
fputc , fgetc
float me = 3.4;

double you = 3.4; 9.....


6.......
if(me = = you) 1. Dennis M.
int Trial (int x, int y, int z)
Ritchie
printf("I love u");
{
else
if ((x > = y) && (z < y)) 2. Dennis C.
printf("I hate u"); Ritchie
return y;
}
else if (x > = y) 3. Dennis N.
I love u Ritchie
return Trial (x,z,y);

else I hate u
4. Dennis O.
return Trial (y,x,z); Richard
I love u I
hate u
}

The function Trial: None of 10......


these
Finds the double max(double); /*
maximum of x, y, and Line 1 */
z
int main ( )
8.......
Finds the main( ) {
minimum of x, y and
z { double da, db;

char a[5]= "ACEEC"; // input da


Finds the
middle number of x, printf("%s", a); db = max(da);
y, z
} }
None of the double max(double a)
main( )
above
{
return a; of 10 elements printf("%d",i+++j);

} 2. An array, }

The above code compiled each element of


without any error or warning. which is a structure
If Line 1 is deleted, the above of type node 14....
code main( )
3. An array,
will show: each element of {
which is a pointer to
no compile warning or error int i;
a structure of type
node
for(i=0;i<100;i++);
some compiler-warnings not 4. A structure printf("%d", i);
leading to unintended results of 2 fields, each field
being a pointer to an }
array of 10 elements
some compiler-warnings due
to type-mismatch eventually 15......
leading to unintended results
int (*ace)();
12....
ace is a pointer to function
The elements of an array are
compiler errors
related by the fact that they
have the same ------------ and
----------. ace is a function pointer
11...
1. type , value
struct ace
ace is a pointer to a function
2. name , type
{ which return int

int i; 3. name , index

float j; ace is a function of pointer


4. index, value variable.
};

struct ace *s[10];


13.... 16.......
define s to be main( )
int main( )
1. A structure {
of 3 fields: an integer, {
a float, and an array int i=5,j=6,z;
int c; do; }

if( ( c=getchar( ) )! = EOF ) while (++i<10);

{ printf ("%d\n",i);

main( ); return 0; 21......

printf("%c",c); } main( )

} {

return 0; 19...... int i = 457;

} { int *iPtr = &i;

static char *s[ ] = { "ice", printf("%d %d",


*((char*)iPtr),
17........ "green", *((char*)iPtr+1) );
A-------------------- is a set of "cone", }
integers represented by
identifiers. "please",

};
Array 22......
static char **ptr[ ] = {s+3, The valid variable is
s+2, s+1, s};
Enumeration name
char ***p = ptr;

printf ("\n %x", **++p);


Structure 0,1,2,3,4
printf("\n %s", *--*++p+3);

printf("\n %s", *p[-2] + 3);


Union $Runtime Error
printf("\n %s", p[-1] [-1] +1);

}
Compiler Error

18.......
20.......
int main (void)
main( )
{ 23........
{
int i=1; main()
Printf("%d",(10>12)?10:12);
{ __________ ; // call to f( )

int i =1; ece }

while (i<=5) Which one of the following


expressions, when placed in
{ eee the blank above, will NOT
printf("%d",i); result in a

if(i>2) None type checking error?

goto here; f(s,*s)

i++;

} 25....... i = f(i,s)

} main ( )

fun() { f(i,*s)

{ int i ;

here: int *pi = &i; f(i,*p)

printf("pp"); scanf("%d", pi);

} printf("%d\n", i + 5);

} 27........

"C" compiler identifies


------------------------ types of
24..... 26........... error

main( ) Which one of the following


statements is TRUE?
{ both
oid f(int, short);
printf("\nec");
void main( )
printf("\bse"); none
{
printf("\rcs");
int i = 100;
} Logical error
short s = 12;
cse
short *p = &s;
Grammatical error else }

printf("x is not five\t"); is:

printf (" value of x is %d\n", 10


x);
28........
return 0;
main() 4
}
{
x is five
int a[] = {0, 0X4, 4, 9}; 6

int i = 2;
x is not five
printf("%d %d", a[i], i[a]); 7

}
value of x is 5
02

31.....
x is five value of x is 5
20 main( )

{
30......
40 float num;
int incr (int i)
num = 20.1248;
{
44 printf("%d", num);
static int count = 0;
}
count = count + i;
Compiler Error
return (count);
29.......
}
int main (void) 20
main ( )
{
{
int x=9; 0
int i, j;
if (x=5)
for (i = 0; i <=4; i++)
printf ("x is five\t"); Runtime Error
j = incr(i);
declared with the char *p = (char *)(malloc*)
------------------------storage (100);
class specifier.
32....... auto
35.........
void main( )
int call (int n);
{ static
int main (void)
while(1)
{
{ if(printf("%d", printf("%d"))) register
printf ("%d", call (2));
break;
printf ("%d" , call (5));
else extern
printf ("%d" , call (2));
continue;
return 0;
}
}
} 34....
int call (int n)
What is the output: can you combine the
following two statements {
Garbage value
into one? static int s=0;

int i;
Compiler error
char *p; for (i=1; i<=n; i++)
p = (char*) malloc(100); s+=i;
Runtime Error
return s;
char p = *malloc(100); }
None of these
3 8 22
char *p = (char) malloc(100);

3 8 21
33.......
char *p =
For a local variable in a (char*)malloc(100);
function to retain its value 3 7 21
between calls to the
function, it must be
2 3 21 d++; Compiler Error

if (n >1) count(n -1);

printf("%d", d); 39......

36...... } main( )

Aliasing in the content of void main ( ) {


programming languages refer
to { int num[ ] = {24, 34, 12, 44,
56, 17};
count (3);
multiple variables having the
same memory location display(&num[0], 6);
}
}
312213444
multiple variables having the display(int *j, int n)
312111222
same value {
3122134
int i = 1;
3121112
multiple variables having the while (i <=n)
same identifier
{

printf("%d ", *j);


multiple uses of the same 38......
variable i++;
int i,j;
j++;
for(i=0;i<=10;i++)
}
{
37....... }
if(i%2!=0)
What will be the output of Output of the above program
printf("%d",i); is _____.
the following C program?
}
void count (int n) garbage values
The output is: 24 34 12 44 56 17
{
0 2 4 6 8 10
static int d = 1; 17 56 44 12 34 24
13579 None
printf("%d" , n);
Runtime Error
printf("%d",d);
40..... statement , when executed in
a repetition statement,
The ------------------ statement causes the next 12
in a called function is used to
pass the value of an iteration of the loop to be
expression performed immediately. 1034
back to the calling function. break

break 44.....
goto goto What does the following
continue code print

return continue
Printf("*\b**\b***\b****\b"
);
41.... return
**********
int i;

char p [20];
*******
char * s = "string"; 43.....

int length = strlen (s); int main( )


*********
for (i = 0 ; i < length; i++) {

p[i] = s[length - i]; char sl[7] = "1234", *p;


error
printf("%s",p); p = sl + 2;

The output of the program is *p = '0';

gnirts printf ("%s", s1);


45......
string }
What is the output of
gnirt What will be printed by the following code
program?
no output is printed int main (void)
1204
{

42...... int z = 14,y,x;


120400
The -------------------- z = z%5;
y = z/3;

x = z/5%3; compiler error

printf("z = %d, y=%d, x= 48......


%d\n", z,y,x);
two strings are not equal What will be output of the
return 0; following code

} main( )
none
z = 4, y = 1, x = 0 {

z = 4, y = 4, x = 0 char *p;

z = 4, y = 4, x = 1 printf("%d%d",
47...... sizeof(*p),sizeof(p));
z = 4, y = 1, x = 1
union values }
{ 12
char w;
46......
float x; 21
What is the output of
following code double y;

};
int main ( ) 23

{ union values v;

What will be the output of


char s1[ ]="ACEEC"; 32
following statement
char s2[ ]="ACEEC";
printf( "% d ", sizeof(v));
if( strcmp( str1, str2))
2
printf("two strings are 49......
equal");
main( )
else 4
{
printf("two strings are not
equal "); unsigned char i=0;
8
for(;i>=0;i++) ;
}

two strings are equal printf("%d\n",i);


16
} int main ( )

Infinite loop e = 0, f = 6 {

float array[5]={1,2,3,4,5};

0 printf("%d", sizeof(array));

51..... }

Compiler Error main( int argc, char * argv[ ] ) 5

Runtime Error while ( --argc > 0 ) 10

printf( "%s %s", *++argv,


(argc>1)? " " : " " );
20
printf( "\n ");
50......
}
What is the output of 25
following code What will be the output of
the above program if we pass
int main( void) string value "hello"
{ Compiler error 53......
int a = 9, b = 15, c = 16, d =
12, e, f; What is the output of
following code
runtime error
e = ! (a f = (a>b) ? a-b: b-a;

printf("e=%d, f=%d\n",e,f);
int main ( )
hello
return 0;
{
}
float array[5]={1,2,3,4,5};
olleh
e=0 f=8
printf("%d", sizeof(array));

}
e=10 f=10
52..... 5

What is the output of


e=6 f=6 following code 10
20

25

You might also like