1. main()
{ int I=3;
while(I–)
{int I=100;
I–;
Printf(“%d”, I);
}
}
find output?
100 99 98 99 98 97 99 99 99 error
Ans:- 99 99 99
2. some program using variable b which was not initialized so
Ans:- error
3. main()
{char ch;
for(ch=’0’;ch<=255;ch++)
printf(“%c”, ch);
}
Ans : infinite loop
4. main()
{
int i=3;
while (i— )
{
int i=100;
i—-;
printf(“%d”, i);
}
}
a) 99 99 99 b)2 2 2 c) error d) none of the above
5. main()
{
unsigned char c;
for (c=0; c!=256; c+)
printf(“%d”, c);
}
6.Size of which data type is same irrespective of operating system.
a) char * b) char c) int d) float
7. What is the output of the following program?
#define SQR(x) (x*x)
main()
{
int a,b=3;
a= SQR(b+2);
printf(“%d”,a);
}
a) 25 b) 11 c) error d) garbage value
8. What is the type of the variable b in the following declaration?
#define FLOATPTR float*
FLOATPTR a,b;
a) float b) float pointer c) int d) int pointer
9. In which line of the following, an error would be reported?
1. #define CIRCUM(R) (3.14*R*R);
2. main()
3. {
4. float r=1.0,c;
5. c= CIRCUM(r);
6. printf(“\n%f”,c);
7. if(CIRCUM(r))==6.28)
8. printf(“\nGobbledygook”);
9. }
a) line 1 b) line 5 c) line 6 d) line 7
10. In the following code;
#include<stdio.h>
main()
{
FILE *fp;
fp= fopen(“trial”,”r”);
}
fp points to:
a) The first character in the file.
b) A structure which contains a “char” pointer which points to the first character in the file.
c) The name of the file. d) None of the above.
11. What would be the output of the following program?
main()
{
char near * near *ptr1;
char near * far *ptr2;
char near * huge *ptr3;
printf(“%d %d %d”,sizeof(ptr1),sizeof(ptr2),sizeof(ptr3));
}
a) 1 1 1 b) 1 2 4 c) 2 4 4 d) 4 4 4
12. What is the difference between the following declarations?
const char *s;
char const *s;
Ans. No difference
13. If the following program (myprog) is run from the command line as myprog friday tuesday sunday? What would be the output?
main(int argc, char*argv[])
{
printf(“%c”,**++argv);
}
a) m b) f c) myprog d) friday
14. What is the meaning memory allocation and why we use it ?
15. What is the meaning of physical memory and virtual memory ?
16 .What are the 3Ms of production ?
17. What does 6 Sigma represent ?
18.What is a register ?
19.llocating memory at runtime is also call as _____ ?
20.What is static and dynamic memory allocation ?
21.What is virtual memory ?
Related posts: