1) what is output for the following program.
#include<stdio.h>
void main()
{
int *p,*q,i;
p=(int*)100;
q=(int*)200;
i=q-p;
printf("%d",i);
}
a)100 b)25 c)0 d)compile error
2)what is output for the following program.
#include<stdio.h>
#define swap(a,b) temp=a,a=b,b=temp;
void main()
{
int a=5,b=6;
int temp;
if(a>b)
swap(a,b);
printf("a=%d,b= %d",a,b);
}
a)a=5 b=6 b)a=6 b=5 c)a=0 b=6 d)None
3)what is output for the following program.
#include<stdio.h>
void main()
{
unsigned char i;
for( i=0;i<300;i++)
{
printf("*");
}
}
a)299 b)300 c)infinite d)none
4)what is output for the following program.
#include<stdio.h>
void main()
{
int n=2;
int sum=5;
switch(n)
{
case 2:sum=sum-2;
case 3:sum*=5;
break;
default :sum=0;
}
printf("%d",sum);
}
a)15 b)0 c)6 d)none
5) What is the program indicates
#include<stdio.h>
void main()
{
char *q;
int *ip;
q=(char*)malloc(100);
ip=(int *)q;
free(ip);
}
6)What is output for the following program.
#include<stdio.h>
void main()
{
int a=10,b=5;
if(a=a&b)
b=a^b;
printf("a=%d,b=%d",a,b);
}
a)a=0,b=5 b)a=10 b=5 c)a=0,b=0 d)none
7) What is output for the following program.
#include<stdio.h>
void main()
{
int a[5],i,*ip;
for(i=0;i<5;i++)
a[i]=i;
ip=a;
printf("%d",*(ip+3*sizeof(int)));
}
a)0 b)5 c)1 d)none
8) What is the size of the structure.
#include<stdio.h>
void main()
{
struct
{
char a;
short b;
int c;
}temp;
}
a)7 b)8 c)12 d)120
9)What is output for the following program.
#include<stdio.h>
void main()
{
unsigned char c[]=0×1,0×2,0×3,0×4,0×11,0×22,0×33,0×44};
unsigned int *p=c;
unsigned short *s=c;
printf("%x %x %x",c[2],p[2],s[2]);
}
10) What is the difference between these two declarations:
i) int *f();
ii)int (*f)()
11) Define pointer to function that take argument as character pointer and return void pointer.
12) 5-2-3*5-2 evaluates 18 then
i)left associative * has precedence over -
ii)right associative * has precedence over -
iii) *left associative - has precedence over *
iv) *right associative - has precedence over *
a) i b)ii c) iii d)iv
Data Structure questions:
13)Difference between re-entrance and recursion.
14)In which data structure recursion can be used.
15)Merge sort problem can be solved using which method.
16)8 queens problem can be solved by using which method.
Computer Networks
1)What is the use of ICMP in TCP/IP stack?
2)What is the use of ARP in TCP/IP stack?
3)What is the header length of Ether Net MAC.
4)What is the mechanisms used for error detection in Data Link Layer?
#include<stdio.h>
void main()
{
int *p,*q,i;
p=(int*)100;
q=(int*)200;
i=q-p;
printf("%d",i);
}
a)100 b)25 c)0 d)compile error
2)what is output for the following program.
#include<stdio.h>
#define swap(a,b) temp=a,a=b,b=temp;
void main()
{
int a=5,b=6;
int temp;
if(a>b)
swap(a,b);
printf("a=%d,b= %d",a,b);
}
a)a=5 b=6 b)a=6 b=5 c)a=0 b=6 d)None
3)what is output for the following program.
#include<stdio.h>
void main()
{
unsigned char i;
for( i=0;i<300;i++)
{
printf("*");
}
}
a)299 b)300 c)infinite d)none
4)what is output for the following program.
#include<stdio.h>
void main()
{
int n=2;
int sum=5;
switch(n)
{
case 2:sum=sum-2;
case 3:sum*=5;
break;
default :sum=0;
}
printf("%d",sum);
}
a)15 b)0 c)6 d)none
5) What is the program indicates
#include<stdio.h>
void main()
{
char *q;
int *ip;
q=(char*)malloc(100);
ip=(int *)q;
free(ip);
}
6)What is output for the following program.
#include<stdio.h>
void main()
{
int a=10,b=5;
if(a=a&b)
b=a^b;
printf("a=%d,b=%d",a,b);
}
a)a=0,b=5 b)a=10 b=5 c)a=0,b=0 d)none
7) What is output for the following program.
#include<stdio.h>
void main()
{
int a[5],i,*ip;
for(i=0;i<5;i++)
a[i]=i;
ip=a;
printf("%d",*(ip+3*sizeof(int)));
}
a)0 b)5 c)1 d)none
8) What is the size of the structure.
#include<stdio.h>
void main()
{
struct
{
char a;
short b;
int c;
}temp;
}
a)7 b)8 c)12 d)120
9)What is output for the following program.
#include<stdio.h>
void main()
{
unsigned char c[]=0×1,0×2,0×3,0×4,0×11,0×22,0×33,0×44};
unsigned int *p=c;
unsigned short *s=c;
printf("%x %x %x",c[2],p[2],s[2]);
}
10) What is the difference between these two declarations:
i) int *f();
ii)int (*f)()
11) Define pointer to function that take argument as character pointer and return void pointer.
12) 5-2-3*5-2 evaluates 18 then
i)left associative * has precedence over -
ii)right associative * has precedence over -
iii) *left associative - has precedence over *
iv) *right associative - has precedence over *
a) i b)ii c) iii d)iv
Data Structure questions:
13)Difference between re-entrance and recursion.
14)In which data structure recursion can be used.
15)Merge sort problem can be solved using which method.
16)8 queens problem can be solved by using which method.
Computer Networks
1)What is the use of ICMP in TCP/IP stack?
2)What is the use of ARP in TCP/IP stack?
3)What is the header length of Ether Net MAC.
4)What is the mechanisms used for error detection in Data Link Layer?