C Aptitude Questions and Answers
1. Guess the output
pritnf (“Both are same”);
printf (“They are different”);
2. Which of the following statements should be used to obtain the reminder after dividing 56.4/6.3?
a. rem = 56.4%6.3;
b. rem = fmod(56.4,6.3);
c. rem = modf(56.4,6.3);
d. Remainder cannot be obtained for floating point division
3. How will you round off the value 7.66 to 8.0 ?
4. What will be the output of the following program?
printf (” Hello “);
printf (” Hai “);
5. In which header file NULL macro is defined?
d. both ‘a’ and ‘b’
6. A pointer is a
a. A variable that stores address of other variable
b. A variable that stores address of an instruction
c. A keyword used to create variables
d. All the above
7. What will be the output of the following code?
static int i=i++, j=j++;
printf (“i= %d\t j= %d”,i,j);
8. What does fp points to in the below program?
a. The first character of the file
b. The last character in the file
c. A structure which contains a char pointer which points to the last character of the file
d. A structure which contains a char pointer which points to the first character of the file
9. What will be the output of the code?
#define square(a) a*a
10. Which of the following function sets first n characters of a string to a given character?
1. They are different
2. (b) rem = fmod( 56.4,6.3)
3. (b) ceil(7.66);
4. (d) error
5. (d) both ‘a’ and ‘b’
6. (a) A variable that stores the address of another variable
7. i=1 j=1
8. ( d) A structure which contains a char pointer which points to the first character of the file
10. (c) strnset()