Sunteți pe pagina 1din 5

Time : 25 Min

1. What would be the equivalent pointer expression foe referring the same element as
a[p][q][r][s] ?
Ans :

2. Are the expressions *ptr ++ and ++ *ptr same?

Ans:

3. Write a program which employs Recursion?


Ans:

4.
int a=1,b=2,c=3;
printf("%d,%d",a,b,c);
What is the output?

Ans:

5. Study the following program and what is the output.

#define MAX(x,y) ((x)>(y)?(x):(y)


main()
{
int x=5,y=5;
printf("maximum is %d",MAX(++x,++y));
}
the output of the programs
a)maximum is 7 (b)maximum is 5 (c)maximum is 6
d)none of the above

Ans:

6. What is the value of r ?

main()
{
int *p,*q,r;
int values[30];
p=&values[0];
q=values+29;
r=++q-p;

7. What will the output of the program? And why ?


enum day = { jan = 1 ,feb=4, april, may}
what is the value of may?
a)4 b)5 c)6 d)11
e)none of the above
8. What will the output of the program? And why ?
#include<stdio.h>
//print the sum of the series 1/5+1/4+....
static int =5;
main()
{
int sum=0;
do
{
sum+=(1/i);
}while(0<i--);
printf("sum of the series is %d",sum);
}
a)it will print the sum of the series 1/5+1/4+....+1/1
b)it will produce a compilation error
c)it will produce a runtime error
d)none of the above
Ans:

9. consider the following expression

int a;
a = 5/9*(4t-32)
if t = 61 what is the value of a ?
Ans:

10. Does the ?: (ternary operator) return a value?

Ans:

11. What will be output of following program?

#include<stdio.h>
int main(){
int a = 320;
char *ptr;
ptr =( char *)&a;
printf("%d ",*ptr);
return 0;

a) 2 b) 320 c) 64 d) None of the above

12. What will be output of following program?

#include<stdio.h>
#include<conio.h>
int main(){
void (*p)();
int (*q)();
int (*r)();
p = clrscr;
q = getch;
r = puts;
(*p)();
(*r)("cquestionbank.blogspot.com");
(*q)();
return 0;
}
a) NULL
b) cquestionbank.blogspot.com
c) c
d) Compilation error

13) What will be output if you will compile and execute the following c code?

struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf("%d %d %d",s.p,s.c,s.m);
}

(a) 2 -6 5
(b) 2 -6 1
(c) 2 2 1
(d) Compiler error

14) What will be output if you will compile and execute the following c code?

void main(){
int i=10;
static int x=i;
if(x==i)
printf("Equal");
else if(x>i)
printf("Greater than");
else
printf("Less than");
}

(a) Equal
(b) Greater than
(c) Less than
(d) Compiler error

15) What will be output if you will compile and execute the following c code?

void main(){
printf("%s","c" "question" "bank");
}

(a) c question bank


(b) c
(c) bank
(d) cquestionbank
(e) Compiler error
16) What will be output if you will compile and execute the following c code?

void start();
void end();
#pragma startup start
#pragma exit end
int static i;
void main(){
printf("\nmain function: %d",++i);
}
void start(){
clrscr();
printf("\nstart function: %d",++i);
}
void end(){
printf("\nend function: %d",++i);
getch();
}

(a)
main function: 2
start function: 1
end function:3
(b)
start function: 1
main function: 2
end function:3
(c)
main function: 2
end function:3
start function: 1
(d) Compiler error
(e) None of these

17)What will be output if you will compile and execute the following c code?

void main(){
int a=-12;
a=a>>3;
printf("%d",a);
}

(a) -4
(b) -3
(c) -2
(d) -96
(e) Compiler error

18) A logic gate is an electronic circuit which

a. Makes logic decisions


b. Allows electron flow in only direction
c. Works on binary algebra
d. Alternates between 0 and 1
19) Multiprogramming was made possible by

a. Input/Output units that operate independently of the CPU


b. Operating Systems
c. Both c and d
d. Neither a and b

20) Data integrity refers to

a. Privacy of data
b. The simplicity of data
c. The validity of data
d. The security of data

21) Which of the following hardware component is most volatile?

a. ROM
b. RAM
c. PROM
d. EEPROM
e.
22) how many interrupts available in 8051 ? and what ?

23) What Is Difference Between Latch And Flip-flop?

24) What will be output of following c code?

void main()
{
struct india
{
char c;
float d;
};
struct world
{
int a[3];
char b;
struct india orissa;
};
struct world st ={{1,2,3},'P','q',1.4};
clrscr();
printf("%d\t%c\t%c\t%f",st.a[1],st.b,st.orissa.c,st.orissa.d);
getch();
}

25) What will be output of following c code? //Calculate size of structure

typedef struct {
char A;
int B;
char C;
} InfoData;
int main(int argc, char *argv[])
{
printf("\n Size of Structure = %d\n\n",sizeof(InfoData)); }

S-ar putea să vă placă și