Explore topic-wise MCQs in Technical MCQs.

This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.

1.

getc() returns EOF when

A. End of files is reached
B. When getc() fails to read a character
C. Both A & B
D. None of the above
E.
Answer» D. None of the above
2.

Note:Includes all required header files using namespace std; int main () { FILE *fp; char x[1024]; fp = fopen("find.txt", "r"); // "ayushjain and prateek" x[0] = getc(fp); fseek(fp, 0, SEEK_END); fseek(fp, -7L, SEEK_CUR); fgets(x, 6, fp); puts(x); return 0;} 18.In fopen(), the open mode "wx" is sometimes preferred "w" because. i) Use of wx is more efficient. ii) If w is used, old contents of file are erased and a new empty file is created. When wx is used, fopen() returns NULL if file already exists.

A. Only i
B. Only ii
C. Both i & ii
D. None of the above
Answer» C. Both i & ii
3.

Note:Includes all required header filesusing namespace std; int main () { int p = 10; double q = 1.14; cout << p + q; endl (cout); return 0; }17.What will be the output of this program?

A. ayushj
B. yushja
C. ayushja
D. prate
Answer» E.
4.

Note:Includes all required header filesusing namespace std; int main () { char i; streambuf * p; ofstream of ("find.txt"); pbuf = of.rdbuf(); do { i = cin.get(); p -> sputc(i); } while (i != '.'); of.close(); return 0; }16.What will be the output of this program?

A. 10
B. 1.14
C. 11.14
D. All of the above
Answer» E.
5.

Note:Includes all required header files using namespace std; int main () { int p = 1000; double q = 3.14; cout << p; cout << endl; cout << q << endl << p * q; endl (cout); return 0; }15.Which of the following is true about the following program

A. insertion operator
B. $ symbol
C. dot operator
D. none of the mentioned
Answer» E.
6.

Note:Includes all required header files using namespace std; int main () { ofstream outfile ("find.txt"); for (int i = 0; i < 70; i++) { outfile << i; outfile.flush(); } cout << "Done"; outfile.close(); return 0; } 14.What is the output of this program?

A. 1000
B. 3.14
C. 3140
D. All of the above
Answer» E.
7.

Note:Includes all required header files using namespace std; int main () { char fine, course; cout << "Enter a word: "; fine = cin.get(); cin.sync(); course = cin.get(); cout << fine << endl; cout << course << endl; return 0; }13.What is the output of this program?

A. Done
B. Error
C. Runtime error
D. None of the mentioned
Answer» C. Runtime error
8.

Note:Includes all required header filesusing namespace std; int main() { ofstream ofile; ofile.open ("find.txt"); ofile << "letsfindcourse" << endl; cout << "Data written to file" << endl; ofile.close(); return 0;} 12.What is the output of this program?

A. course
B. fine
C. Returns fine 2 letter or number from the entered word
D. None of the mentioned
Answer» D. None of the mentioned