Q121
Open question#include <stdio.h>
#include <string.h>
int main()
{
char line[3];
fgets(line, 3, stdin);
printf("%d\n", strlen(line));
return 0;
}Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
296
Questions
7/15
Page
Pick an option on a question to see the right answer and solution.
Q121
Open question#include <stdio.h>
#include <string.h>
int main()
{
char line[3];
fgets(line, 3, stdin);
printf("%d\n", strlen(line));
return 0;
}Select an option to see the answer and solution.
Q122
Open questionchar str[] =”Good”;
scanf(“%s”, str);Select an option to see the answer and solution.
Q123
Open questionSelect an option to see the answer and solution.
Q124
Open questionSelect an option to see the answer and solution.
Q125
Open questionSelect an option to see the answer and solution.
Q126
Open question#include <stdio.h>
int main()
{
FILE *fp = stdout;
int n;
fprintf(fp, "%d ", 45);
fflush(stdout);
fprintf(stderr, "%d", 65);
return 0;
}Select an option to see the answer and solution.
Q127
Open question#include <stdio.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}Select an option to see the answer and solution.
Q128
Open questionSelect an option to see the answer and solution.
Q129
Open questionSelect an option to see the answer and solution.
Q130
Open questionSelect an option to see the answer and solution.
Q131
Open questionSelect an option to see the answer and solution.
Q132
Open questionint ungetc(int c, FILE *fp)Select an option to see the answer and solution.
Q133
Open question#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("%d\n", rand());
return 0;
}Select an option to see the answer and solution.
Q134
Open questionungetc(c, fp);//where declarations are int c and FILE *fpSelect an option to see the answer and solution.
Q135
Open questionscanf("%d %f %c", &s1, &s2, &s3);Select an option to see the answer and solution.
Q136
Open questionint *ip = (int *)malloc(sizeof(int));Select an option to see the answer and solution.
Q137
Open questionSelect an option to see the answer and solution.
Q138
Open question#include <stdio.h>
int main()
{
FILE *fp;
char c;
int n = 0;
fp = fopen("newfile1.txt", "r");
while (!feof(fp))
{
c = getc(fp);
putc(c, stdout);
}
}Select an option to see the answer and solution.
Q139
Open questionprintf("\n The number is %07d",1212);Select an option to see the answer and solution.
Q140
Open questionSelect an option to see the answer and solution.