Thursday, 16 August 2012

Oracle Recruitment 2012 - Aptitude Questions And Basic Computer Knowledge

Oracle Financial Services Campus Recruitment - 2012

Aptitude Questions
 
BASIC COMPUTER KNOWLEDGE – Sample Questions
C - Aptitude Questions
This is the Basic level of the C assessment. No points will be deducted for wrong answers. 

Question Number 1
Which among the following are TRUE?
I. User has to explicitly define the numeric values of enumerations.
II. User has a control over the size of enumeration variables.
III. Enumerations cannot take negative values.
IV. Enumerations can have an effect local to the block if desired.
a. I and II
b. IV only
c. III and IV
d. II and III


Question Number 2
What will be the output of the following program?
struct emp
{
int length;
char* name;
};
int main()
{
char *vName = "Joseph";
struct emp *eVar = (struct emp*)malloc(sizeof(struct emp));
eVar->length = strlen(vName);
eVar->name = (char*)malloc(eVar->length+1);
strcpy(eVar->name, vName);
printf("%d %s\n", eVar->length, eVar->name);
free(eVar->name);
free(eVar);
return 0;
}
a. 6 Joseph
b. Compiler error
c. JunkValue Joseph
d. Runtime error


Question Number 3
Sizes of integral types are defined in which of the following headers?
a. ctype.h
b. stdarg.h
c. limits.h
d. cmath.h
Question Number 4
What will be the output of the following program?
int main()
{
union x
{
char v1;
short int v2;
};
union x x1;
x1.v2 = 1024;
printf("%d\n",(x1.v1 & 0xff00));
return 0;
}

a. Compiler error
b. 1024
c. 0
d. 1064


Question Number 5
What will be the output of the following program?
main()
{
int Oxygen=5;
printf("%d\n%d\n%d",Oxygen,Oxygen<<5,Oxygen>> 5);
return 0;
}
a. 5
160
 5
b. 5
160
0
c. 0
160
5
d. 5
128
0
Question Number 6
The __________ modifier hints to the compiler that the variable will be heavily used and should be kept in the CPU's registers.
a. Static
b. Register
c. Auto
d. Volatile


Question Number 7
What could be the correct reason for the below program to fail upon compilation?
Sum(int a, int b)
{
int a;
a = 57;
a = a + b;
return a;
}
I. Invalid arguments to the function.
II. Re-declaration of a.
III. Function must have a return type specified.

a. II only
b. II and III
c. I only
d. III only


Question Number 8
What will be the output of the following program?
void main()
{
printf("Value : %d",10^9);
}

a. Value : 1
b. Value : 3
c. Error
d. None of the above 
Question Number 9
What will be the output of the following program?
#include<stdio.h>
int main()
{
int ivar;
for(ivar=1;ivar<4,ivar++)
switch(ivar)
case 1: printf("%d",ivar);break;
{
case 2:printf("%d",ivar);break;
case 3:printf("%d",ivar);break;
}
switch(ivar)
case 4:printf("%d",ivar);
return 0;
a. 1 2 3 4
b. No output
c. 1 2 3
d. Compiler error


Question Number 10
What will be the output of the following program?
#include<stdio.h>
void Test(int i)
{
printf( "int ");
}
void Test(int &i)
{
printf( "int &");
}
void main()
{
int x=10;
Test(x);

 
a. Compiler error
b. int
c. Runtime error
d. int &


Question Number 11
What will be the output of the following program?
int main()
{
int i=1;
for( ; i < 5; i++);
printf("%d ", i);
return 0;
}

a. 1 2 3 4
b. 1
c. 1 2 3 4 5
d. 5


Question Number 1 2
What will tempStr contain after execution of the following program assuming that file.txt contains "abcdefg"?
int main()
{
char tmpStr[80];
FILE* fp = NULL;
fp = fopen("file.txt","rb");
fseek(fp, 4, SEEK_SET);
fgets(tmpStr, sizeof(tmpStr), fp);
return 0;
}

a. abcdefg
b. NULL
c. efg
d. efg followed by junk characters


Question Number 13
What will be the output of the following program?
#include<stdio.h>
int main()
{
if("lakeside"=="lakeside")
printf("Equal");
else
printf("Not equal");
return 0;
a. Not equal
b. Equal
c. Compiler error
d. None of the above

Question Number 14
Which among the following statements are TRUE?
I. The expression num[1] designates the very first element in the array.
II. It is necessary to initialize the array at the time of declaration.
III. The declaration num[SIZE] is allowed if SIZE is a macro.

a. I and II
b. I and III
c. III only
d. II and III


Question Number 15
What will be the output of the following program assuming file.txt contains "how are you"?
int main()
{
char ch; FILE* fp;
fp = fopen("file.txt","r");
while((ch=getc(fp)) != NULL)
printf("%c", ch);
fclose(fp);
}

a. Compiler error
b. 'how are you' followed by infinite loop
c. Does not print anything and stays in while loop
d. how are you


Question Number 16
Which of the following is TRUE about void pointer?
I. Void pointer has no datatype declared with it and it can be used to point variable of any datatype.
II. Void pointers does not occupy any memory.
III. Void pointers points to nothing. 
a. I only
b. I and III
c. II and III
d. I, II, and III


Question Number 17
Which of the following is TRUE about fseek(fileptr,0,SEEK_SET)?
a. Sets the file position marker to the middle of the file
b. Sets the file position marker to the end of the file
c. Its not a valid option
d. Sets the file position marker to the starting of the file


Question Number 18
Which of the following statements is/are FALSE?
I. Arrays can be passed by reference to a function.
II. Arrays can be passed by value to a function.
III. In pass by value the maximum array size cannot be more than 8KB. 
a. I and II
b. II and III
c. I, II, and III
d. II only


Question Number 19
Which among the following statements are TRUE?
I. stderr, stdin and stdout are FILE pointers.
II. Offset used in fseek() function call can be a negative number.
III. In a call to printf() function, the format specifier, %b , can be used to print binary equivalent of an integer.

a. II and III
b. I and II
c. III only
d. I and III


Question Number 20
Which of the following statements, is correct?
a. strcmp ( s1 , s2 ) returns a number less then 0 if s1 > s2
b. strcmp ( s1 , s2 ) returns 0 if s1 == s2
c. strcmp ( s1 , s2 ) returns a number greater then 0 if s1 < s2
d. strcmp ( s1 , s2 ) returns 1 if s1 == s2

No comments:

Post a Comment