Which one of the following is correct syntax for opening a file.
A. FILE *fopen(const *filename, const char *mode)
B. FILE *fopen(const *filename)
C. FILE *open(const *filename, const char *mode)
D. FILE open(const*filename)
Select an option to see the answer and solution.
What will be the output of the following C code (when 4 and 5 are entered)?
#include <stdio.h>
void main()
{
int m, n;
printf("enter a number");
scanf("%d", &n);
scanf("%d", &m);
printf("%d\t%d\n", n, m);
}A. Error
B. 4 junkvalue
C. Junkvalue 5
D. 4 5
Select an option to see the answer and solution.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 10, j = 3;
printf("%d %d %d", i, j);
}A. Compile time error
B. 10 3
C. 10 3 some garbage value
D. Undefined behaviour
Select an option to see the answer and solution.
What will cos(x) return?
A. sine of x where x is in radians
B. sine of x where x is in degree
C. cosine of x where x is in radians
D. cosine of x where x is in degree
Select an option to see the answer and solution.
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int n;
scanf("%d", n);
printf("%d", n);
}A. Prints the number that was entered
B. Segmentation fault
C. Nothing
D. Varies
Select an option to see the answer and solution.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
short int i;
scanf("%h*d", &i);
printf("%hd", i);
return 0;
}A. Compilation error
B. Undefined behavior
C. Somegarbage value
D. Depends on the standard.
Select an option to see the answer and solution.
Choose the right statement for fscanf() and scanf()
A. fscanf() can read from standard input whereas scanf() specifies a stream from which to read
B. fscanf() can specifies a stream from which to read whereas scanf() can read only from standard input
C. fscanf() and scanf() has no difference in their functions
D. fscanf() and scanf() can read from specified stream
Select an option to see the answer and solution.
What is the function of the mode ' w+'?
A. create text file for writing, discard previous contents if any
B. create text file for update, discard previous contents if any
C. create text file for writing, do not discard previous contents if any
D. create text file for update, do not discard previous contents if any
Select an option to see the answer and solution.
gets() does the following when it reads from stdin.
A. Deletes the 't'
B. Puts adds it.
C. Deletes the terminating 'n'
D. Nothing
Select an option to see the answer and solution.
What is the qualifying input for the type specifier G?
A. floating point numbers
B. floating point numbers in exponential format
C. floating point numbers in the shorter of exponential format
D. not a type specifier
Select an option to see the answer and solution.
Which of the following doesn't require an & for the input in scanf()?
A. char name[10];
B. int name[10];
C. float name[10];
D. all of the mentioned
Select an option to see the answer and solution.
For floating point numbers, the precision flag specifies the number of decimal places to be printed. When no precision modifier is specified, printf() prints . . . . . . . .
A. six decimal positions
B. five decimal positions
C. four decimal positions
D. three decimal positions
Select an option to see the answer and solution.
Which of the following is the correct syntax for calling function ungetc?
Assume int c and FILE *fpA. ungetc(c,*fp);
B. ungetc(c, fp);
C. ungetc(fp, c);
D. ungetc(*fp,c);
Select an option to see the answer and solution.
Which of the following cannot be used with ungetc()?
A. scanf
B. getc
C. getchar
D. printf
Select an option to see the answer and solution.
Which character of pushback is guaranteed per file?
A. True
B. False
C. Depends on the compiler
D. Depends on the platform
Select an option to see the answer and solution.
If the user enters 1 s 3.2, what value will be returned by the scanf()?
scanf("%d %f %c", &a, &b, &c);A. 1
B. 2
C. 3
D. no return value
Select an option to see the answer and solution.
String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.
A. Presence of NULL character
B. Presence of new-line character
C. Presence of any escape sequence
D. None of the mentioned
Select an option to see the answer and solution.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
char str[10] = "hello";
char *p = strrchr(str, 'l');
printf("%c\n", *(++p));
}A. l
B. o
C. e
D. Compilation error
Select an option to see the answer and solution.
Which function will return the current file position for stream?
A. fgetpos()
B. fseek()
C. ftell()
D. fsetpos()
Select an option to see the answer and solution.
When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?
A. Standard input
B. Standard output
C. Standard error
D. All of the mentioned
Select an option to see the answer and solution.