Model Paper I
Model Paper I
Answer The Following Questions:
Q1: What is the Output of Following Program?
main ()
{
char str={'H','E','L','L','O','\0'}
printf("%s/n",str+1);
}
(a)prints ELLO
(b)prints HELLO
(c)prints ILLO (i.e.'H' is incremented by 1)
(d)None of the Above
Q2: What is the Output of the following Program?
main()
{
int
counter=1;
for(;;)
{
counter++;
if(counter>9)
break;
}
}
in
the above program
(a)error
b'coz for should have parameters
(b)error
bcoz 2 semicolons in a for loop are invalid
(c)no
error,loop is executed once
(d) no error ,loop is
executed 10 times
Q3:What is the output of the Following Program?
#define int INTEGER/*line1*/
#define INTEGER int/*line 2*/
main()
{
INTEGER p=10;/*line 5*/
printf("%d",p);
}
o/p?
(a) compiler error at line 1
(b) compiler error at line 2
(c) compiler error at line 5
(d) No error,prints 10
Q4: Which
of the following is illegal
(a)void v;
(b)void *v;
(c)void **v;
(d)all are legal
Q5: A question on malloc
int *p;
p=malloc(sizeof(int)*5);
if malloc returned the address 1000;the value of p+1 is
(a)1002
(b)1004
(c)1008
(d)100F
Q6: What is the o/p?
main()
{
char arr[5]={'a','a','b','c','d','e'};
printf("%s",arr);
}
Q7: What is the o/p of following Program?
#define f(x,y) x=x+y;y=x-y;x=x-y;
main()
{
int a=10,b=5;
f(a,b);
printf(“ The values of a and b are, %d, %d”,a,b);
}
a) 10 5 b) 5 10 c) 5 5 d) 10 10
Q8: what is the out put of following Program?
main()
{
void *ptr;
int i=1;
ptr=&i;
ptr++;
}
a) the size of ptr incremented by 1 byte
b) the size of ptr incremented by 2 bytes
c) the size of ptr incremented by 4 bytes
d) none
Q9:
main()
{
int a=10,b=7,c=15,z;
z=?;
printf(“Biggest number is %d”, z);
}
Write the expression for z to print the biggest of three numbers using
conditional operator.
Q10:
if( condition)
{
printf(“Hello”);
}
else
{
printf(“ World”);
}
What should be the condition to display the output as “hello world”.
All the above questions are collected from Different Websites Answers will be Update soon.