1. Guess the output
main()
{
float a=8.4;
double b=8.4;
if (a==b)
pritnf (“Both are same”);
else
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 ?
a. roundto(7.66);
b. ceil(7.66);
c. floor(7.66);
d. roundup(7.66);
4. What will be the output of the following program?
void main()
{
int a=3;
switch(a)
{
case 1:
printf (” Hello “);
break;
case 2:
printf (” Hai “);
break;
case 3:
continue;
case 4:
printf (“Hi”);
break;
}
}
a. HiHelloHai
b. Hi
c. Hello
d. error
5. In which header file NULL macro is defined?
a. stdio.h
b. stddef.h
c. stdlib.h
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?
void main()
{
static int i=i++, j=j++;
printf (“i= %d\t j= %d”,i,j);
}
8. What does fp points to in the below program?
main()
{
FILE *fp;
fp= fopen(“sample”,”r”);
return 0;
}
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
main()
{
int i;
i= 4/square(2);
printf(“%d”, i);
}
10. Which of the following function sets first n characters of a string to a given character?
a. strinit()
b. strset()
c. strnset()
d. strcset()
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
9. 4
10. (c) strnset()
main()
{
float a=8.4;
double b=8.4;
if (a==b)
pritnf (“Both are same”);
else
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 ?
a. roundto(7.66);
b. ceil(7.66);
c. floor(7.66);
d. roundup(7.66);
4. What will be the output of the following program?
void main()
{
int a=3;
switch(a)
{
case 1:
printf (” Hello “);
break;
case 2:
printf (” Hai “);
break;
case 3:
continue;
case 4:
printf (“Hi”);
break;
}
}
a. HiHelloHai
b. Hi
c. Hello
d. error
5. In which header file NULL macro is defined?
a. stdio.h
b. stddef.h
c. stdlib.h
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?
void main()
{
static int i=i++, j=j++;
printf (“i= %d\t j= %d”,i,j);
}
8. What does fp points to in the below program?
main()
{
FILE *fp;
fp= fopen(“sample”,”r”);
return 0;
}
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
main()
{
int i;
i= 4/square(2);
printf(“%d”, i);
}
10. Which of the following function sets first n characters of a string to a given character?
a. strinit()
b. strset()
c. strnset()
d. strcset()
ANSWERS
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
9. 4
10. (c) strnset()
0 comments:
Post a Comment