Tuesday, April 29, 2008

Oracle placements recent papers

Oracle placements recent papers

21. What is true about the following C functions?
(A) Need not return any value. (B) Should always return an integer.
(C) Should always return a float. (D) Should always return more than one value.

22. enum number { a=-1, b=4, c,d,e,} what is the value of e?
(A) 7 (B) 4 (C) 5 (D) 3

23. Which of the following about automatic variables within a function is correct?
(A) Its type must be declared before using the variable. (B) They are local.
(C) They are not initialized to zero. (D) They are global.

24. Consider the following program segment
int n, sum=5;
switch(n)
{
case 2:sum=sum-2;
case 3:sum*=5;
break;
default:sum=0;
}
if n=2, what is the value of the sum?
(A) 0 (B) 15 (C) 3 (D) None of these.


25. Which of the following is not an infinite loop?
(A) x=0; (B) # define TRUE 0....
do{ While(TRUE){....}
/*x unaltered within the loop*/ (C) for(;;) {....}
....}
While(x==0); (D) While(1) {....}

26. Output of the following program is
main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i){
case 0:
i+=5;
case 1:
i+=2;
case 5:
i+=5;
default:
i+=4;
break;
}
}
}
(A) 5,9,13,17 (B) 12,17,22 (C) 16,21 (D) syntax error.

27. What does the following function print?
func(int i)
{
if(i%2) return 0;
else return 1;
}
main()
{
int i=3;
i=func(i);
i=func(i);
printf("%d",i);
}
(A) 3 (B) 1 (C) 0 (D) 2

28. What will be the result of the following program?
char*g()
{
static char x[1024];
return x;
}
main()
{
char*g1="First String";
strcpy(g(),g1);
g1=g();
strcpy(g1,"Second String");
printf("Answer is:%s", g());
}
(A) Answer is: First String (B) Answer is: Second String
(C) Run time Error/Core Dump (D) None of these

29. Consider the following program
main()
{
int a[5]={1,3,6,7,0};
int *b;
b=&a[2];
}
The value of b[-1] is
(A) 1 (B) 3 (C) -6 (D) none

30. Given a piece of code
int x[10];
int *ab;
ab=x;
To access the 6th element of the array which of the following is incorrect?
(A) *(x+5) (B) x[5] (C) ab[5] (D) *(*ab+5}

0 comments: