Point out the error in the program?
#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("trial", "r");
fseek(fp, "20", SEEK_SET);
fclose(fp);
return 0;
}
Answer
If the size of pointer is 4 bytes then What will be the output of the program ?
#include<stdio.h>
int main()
{
char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"};
printf("%d, %d", sizeof(str), strlen(str[0]));
return 0;
}
Answer
What will be the output of the program ?
#include<stdio.h>
int main()
{
char str = "IndiaBIX";
printf("%s\n", str);
return 0;
}
Answer
What will be the output of the program ?
#include<stdio.h>
int main()
{
char str1[] = "Hello";
char str2[10];
char *t, *s;
s = str1;
t = str2;
while(*t=*s)
*t++ = *s++;
printf("%s\n", str2);
return 0;
}
Answer
Which of the following function sets first n characters of a string to a given character?
AnswerA header file contains macros, structure declaration and function prototypes.
AnswerIn a macro call the control is passed to the macro.
AnswerA macro must always be defined in capital letters.
AnswerIs it true that too many recursive calls may result into stack overflow?
AnswerWhat will be the output of the program?
#include<stdio.h>
#include<math.h>
int main()
{
printf("%f\n", sqrt(36.0));
return 0;
}
Answer
Can we use a switch statement to switch on strings?
AnswerWhich of the following statements are correct about an if-else statements in a C-program?
1: | Every if-else statement can be replaced by an equivalent statements using ?: operators |
2: | Nested if-else statements are allowed. |
3: | Multiple statements in an if block are allowed. |
4: | Multiple statements in an else block are allowed. |
What will be the output of the program?
#include<stdio.h>
int main()
{
float a = 0.7;
if(0.7 > a)
printf("Hi\n");
else
printf("Hello\n");
return 0;
}
Answer
What will be the output of the program, if a short int is 2 bytes wide?
#include<stdio.h>
int main()
{
short int i = 0;
for(i<=5 && i>=-1; ++i; i>0)
printf("%u,", i);
return 0;
}
Answer
What is the purpose of fflush() function.
AnswerAre the following declarations same?
char far *far *scr;
char far far** scr;
Answer
We can allocate a 2-Dimensional array dynamically.
AnswerIn a function that receives variable number of arguments the fixed arguments passed to the function can be at the end of argument list.
AnswerIf malloc() successfully allocates memory it returns the number of bytes it has allocated.
AnswerWhich header file should be included to use functions like malloc() and calloc()?
Answer© 2017 QuizBucket.org