Sie sind auf Seite 1von 9

.

rm75
.op
# C-TEST
------#

1.
main()
{
char *name[7]={"Kajol","Tabbu","Priti","Neha"};
printf("%d",sizeof(name)/sizeof(char *));
}

wha� i� th� output?

a) 4 b) 5 c) 7 d) 19

2.
main()
{
int k;
k=1+3,2<4,5;
printf("%d",k);
}

wha� i� th� o/p?

a) 1 b) 4 c) 5 d) error

3.
#define PRINT(int) printf( "%d ", int)
main()
{
int x=01,y=02,z=03;
PRINT (x | y & ~z);
PRINT (x & y && z);
PRINT (x ^ y & ~z);

}
wha� i� th� o/p?

a) 0 0 0 b) 0 1 0 c) 1 0 1 d) 1 1 1

4.
#include <stdio.h>
int mybranch(char *string)
{
char *pointer =string;
while(*pointer++);
return pointer-string-1;
}
main()
{
printf("%d", mybranch("MCA"));
}�
wha� i� th� output?

a) -1 b) 1 c) 2 d) 3

5.
#include<stdio.h>
main()
{
int x=5,y;
void message();
printf("X: %d\n",x);
y=message();
printf("Y: %d\n",y);
}
void message()
{
printf("Ha-Ha-Ha\n");
}

a) X: 5 b) X: 5 c) X: 5 d) error
Y: 8 Y: 9 Y: garbage

6.
#include<stdio.h>
main()
{
long long int i=50;
i==50000000000;
printf("%d,%d",sizeof(i),i);

What is the o/p if size of int is 4 ?

a) 12,50000000000 b) 8,garbage c) 8,50 d) error

7.
#include<stdio.h>
main()
{
#ifdef EOF
int a=10;
#else
int a=20;
#endif
int b=20;
printf("%d",a+b);
}�

fi�� th� output?

a) 40 b) 30 c) 20 d) 10
8.
# include<ctype.h>
main()
{
char a;
a = 'a';
if isupper(a)
printf("entered value is upper");
else
printf("entered value is lower");

wha� i� th� o/p?

a) entered value is uppper b) entered value is lower

c) no output d) error

9.
#include<stdio.h>
main()
{
struct s1
{
char *z;
int i;
struct s1 *p;
};
static struct s1 a[]={
{"Jamshedpur",1,a+1},
{"Raipur",2,a+2},
{"Kanpur",3,a}
};
struct s1 *ptr=a;
int j;

printf("%s %s %s\n",a[0].z,ptr->z,a[2].p->z);
}

fin� th� o/p?

a) Jamshedpur Jamshedpur Kanpur b) Jamshedpur Raipur Raipur

c) Jamshedpur Jamshedpur Jamshedpur d) Raipur Jamshedpur Raipur

10.
#include <stdio.h>
main()
{
int i=100,j=200,k=300;
printf("%d %d %d");
}
wha� i� th� output?

a) 100 200 300 b) 300 200 100 c) 0 0 0 d) error

11.
#include<stdio.h>
main()
{
int x =100;
if(!!x)
printf("x=%d",!x);
else
printf("x=%d",x);
}

wha� i� th� output?

a) x=0 b) x=1 c) x=100 d) error

12.
#include<stdio.h>
main()
{
register int k;
int *a,*b,*p;
*a=k=(9)+2;
b=a;
p=&k;
printf("%d %d",*p,*b);
}

wha� i� th� o/p?

a) 11 11 b) 9 11 c) 11 9 d) error

13.
#include<stdio.h>
void main(void)
{
int i=5;
{
int i=10;
printf("%d",i);
int j=i;
}
printf("%d",i);
j+=i;
printf("%d",j);

}
wha� i� th� output?

a) 10 10 20 b) 10 5 10 c) 10 5 15 d) error

14.
#include<stdio.h>
main()
{
printf("%%dd",20);
}

fin� th� output?

a) 20 b)20d c) %dd d) error

15.
#include<string.h>
main()
{
char strp[] = "Never ever say no";
char *chp, v='e';
int i,j;
chp = strrchr(strp, v);
i = chp-strp;
for(j=0;j<=i;j++)
printf("%c",strp[j]);
}

wha� i� th� o/p?

a) Never ev b) Never eve c) Neve d) Never ever say no

16.

supposing that each integer occupies 4 bytes and each charactrer


1 byte , what is the output of the following programme?

#include<stdio.h>
main()
{
int a[] ={ 1,2,3,4,5,6,7};
char c[] = {'s','a','n','j','u'};
printf("%d %d", (&a[3]-&a[0]),(&c[3]-&c[0]));
}
a) 6 3 b) 12 3 c) 3 3 d) 3 6

17.
#include<stdio.h>
fun(int);
main()
{
int n=10;
fun(n);
}
int fun( int n)
{
int i;
for(i=0;i<=n;i++)
fun(n-i);
printf("Well done!!");

howmany times is the printf statement executed for n=10?

a) 0 times b) 10 times c) 11 times d) infinite times

18.
main()
{
struct emp{
char emp[];
int empno;
float sal;
};
struct emp member = {"TIGER"};
printf(" %d, %f", member.empno,member.sal);
}

a) TIGER, 0.000000 b) 0, 0.000000 c) error

d) TIGER, garbage value

19.
#include<malloc.h>
char *f()
{char *s=malloc(8);
strcpy(s,"goodbye");}
main()
{
char *f();
printf("%c",*f()='A');
}

wha� i� th� o/p?

a) A b) goodbye c) g d) none of these


20.
main()
{
unsigned char c;

for(c=0; c!=256; c++)


printf("%d",c);
}

fin� th� output?

a) 0 b) 255 c) 256 d) none of these

21.
#include<stdio.h>
main()
{int i=3;
while(i--)
{
int i=100;
i--;
printf("%d...",i);
}
}
wha� i� th� output?

a) 99...99...99..� b) error
c) 99...99...99...99..� d) 3...22...1...


22.
main()
{
unsigned int a=3;
unsigned int b=2;

if(a+b < -1)


printf("True");
else
printf("False");

fin� th� output?

a) True b) False c) no output

d) True if int is 32 bits


False if int is 16 bits

23.
#include<stdio.h>
static int k=2;
void main(void)
{
int sum=0;
do { sum+=(1/k);} while(0<k--);

printf("%d",sum);
}

What is the value printf will print?

a) 0 b) nothing c) garbage value d) 3

24.
main()
{
int flag=-1;
if(flag)
printf("\n girls r good");
else;
printf("\n boys r good");

}
wha� i� th� o/p?

a) girls r goo� b) boys r good


c) erro� d) none of these


29.
#include<stdio.h>
#define ONE 4
#define TWO 3
#define THREE 5.4

main()
{
int i=4;
switch(i)
{
case ONE: i++;
case TWO: i+=2;
default : i=2;
}
printf("%d",i);
}

wha� i� th� output?

a) 2 b) 4 c) 5 d) error

30.
#include<stdio.h>
main()
{
int a[]={50,40,30,20,10};
int i;
i=a[2,3];
printf("%d",i);
}

fin� th� output?

a) 30 b) 20 c) 10 d) 50

# **********BES� O� LUC�************ #

##################################################################################
#####

Das könnte Ihnen auch gefallen