Question 1 of 25
Hints left: 3
Q1
Which function is used to write data to a file in C?
Q2
What is the difference between 'r+' and 'w+' modes when opening a file in C?
Q3
Which function is used to rename a file in C?
Q4
What will be the output of the following C code? #include <stdio.h> struct p { int x[2]; }; struct q { int *x; }; int main() { struct p p1 = {1, 2}; struct q *ptr1 = (struct q*)&p1; ptr1->x = (struct q*)&p1.x; printf("%d\n", ptr1->x[0]); }
Q5
How do you check if a file exists in C?
Q6
What does the 'fread' function in C do?
Q7
What is the purpose of the 'fprintf' function in C?
Q8
What is the difference between 'r' and 'w' modes when opening a file in C?
Q9
Which function is used to open a file in C for writing?
Q10
What will be the output of the following C code? #include <stdio.h> struct point { int x; int y; }; struct notpoint { int x; int y; }; void foo(struct point); int main() { struct notpoint p1 = {1, 2}; foo(p1); } void foo(struct point p) { printf("%d\n", p.x); }
Q11
Which function is used to delete a file in C?
Q12
In C, what does the 'feof' function return if the end of the file is reached?
Q13
Which function is used to close a file in C?
Q14
Which function is used to read a line of text from a file in C?
Q15
How do you check if a file was opened successfully in C?
Q16
What will be the output of the following C code? #include <stdio.h> typedef struct student { char *a; }stu; void main() { stu s; s.a = "hi"; printf("%s", s.a); }
Q17
How do you read a character from a file in C?
Q18
typedef int (*PFI)(char *, char *)creates . . . . . . . .
Q19
In C, which library is used for file operations such as reading and writing files?
Q20
Which function is used to move the file pointer to a specific position in a file?
Q21
What will be the output of the following C code? #include <stdio.h> struct { int k; char c; }; int main() { struct p; p.k = 10; printf("%d\n", p.k); }
Q22
In C, what is the function of the 'feof' function?
Q23
What is the purpose of the 'ftell' function in C?
Q24
What is the purpose of the 'rewind' function in C?
Q25
What does 'FILE' represent in C when working with files?