Beruflich Dokumente
Kultur Dokumente
rm75
.op
# C-TEST
------#
1.
main()
{
char *name[7]={"Kajol","Tabbu","Priti","Neha"};
printf("%d",sizeof(name)/sizeof(char *));
}
a) 4 b) 5 c) 7 d) 19
2.
main()
{
int k;
k=1+3,2<4,5;
printf("%d",k);
}
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);
7.
#include<stdio.h>
main()
{
#ifdef EOF
int a=10;
#else
int a=20;
#endif
int b=20;
printf("%d",a+b);
}�
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");
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);
}
10.
#include <stdio.h>
main()
{
int i=100,j=200,k=300;
printf("%d %d %d");
}
wha� i� th� output?
11.
#include<stdio.h>
main()
{
int x =100;
if(!!x)
printf("x=%d",!x);
else
printf("x=%d",x);
}
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);
}
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);
}
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]);
}
16.
#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!!");
18.
main()
{
struct emp{
char emp[];
int empno;
float sal;
};
struct emp member = {"TIGER"};
printf(" %d, %f", member.empno,member.sal);
}
�
19.
#include<malloc.h>
char *f()
{char *s=malloc(8);
strcpy(s,"goodbye");}
main()
{
char *f();
printf("%c",*f()='A');
}
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;
23.
#include<stdio.h>
static int k=2;
void main(void)
{
int sum=0;
do { sum+=(1/k);} while(0<k--);
printf("%d",sum);
}
24.
main()
{
int flag=-1;
if(flag)
printf("\n girls r good");
else;
printf("\n boys r good");
}
wha� i� th� o/p?
�
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);
}
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);
}
a) 30 b) 20 c) 10 d) 50
# **********BES� O� LUC�************ #
##################################################################################
#####