1. What is the output of the following code ?
int main( )
{
for( ; ;);
printf("Hello\n");
return 0;
}
a. give compilation error
b. prints Hello infinite times
c. Runs in an infinite loop without printing anything.
d. prints Hello once.
Ans: c
2. Output of the code?
FUNC (int *p)
{
p = (int *)malloc(100);
printf("p:%x",p);
}
int main( )
{
int *ptr;
FUNC(ptr);
printf("Ptr:%x",ptr);
return 0;
}
a. Both printf statements prints same values.
b. Both print different values.
c. Gives compile time error.
d. Gives run time error.
Ans: b
3. Output of the code?
int main()
{
char a[] = "world";
printf("%d %d\n",strlen(a),sizeof(a));
return 0;
}
a. 5,5
b. 6,5
c. 5,6
d. 6,6
Ans: c
4. What is the output generated?
main()
{
char *s = "Hello";
printf("%s",1(s));
}
a. Hello
b. ello
c. e
d. none of these.
Ans: b
5. Interpret the given declaration
char ( * ( f ( ) ) [ ] )( )
a. f is a pointer to function returning char
b. f is a pointer to an array of function returning a char
c. Invalid declaration
d. f is a function returning pointer to array[] of pointer to function returning char.
Ans : d
1. A binary tree of height h, h > 0 has
a. at least h and atmost 2*h-1 elements in it.
b. at least 2^h and atmost (2^h)+1 elementz in it.
c. at least 2^h -1 and atmost h^2 elements in it.
d. at least h and atmost (2^h) - 1 elements in it.
Ans: d
2. Thrashing is
a. flooding of pages in the memory.
b. increase in removal of pages from memory.
c. increase in page faults leading to decrease in CPU utilization.
d. removal of unused pages from memory making space for new ones.
Ans: c
3. Recursive Descent parser is a type of
a. Bottom up parser.
b. Top Down parser.
c. None of these.
d. Bottom down parser.
Ans: b
4. alloca() allocates memory from
a. Heap.
b. Reserved memory.
c. Data segment.
d. Stack.
Ans: d
5. What is the octal equivalent of decimal (5468).
a. 12360.
b. 12560.
c. None of these.
d. 12650.
Ans : c
Saturday
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment