This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 61 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 61 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. How do you read a character from a file in C using fgetc()? A) Fgetc(file);. B) ReadChar(file);. C) GetChar(file);. D) File.getc();. Show Answer Correct Answer: A) Fgetc(file);. 2. Which method could be used to strip specific characters from the end of a string? A) Estrip. B) Rstrip. C) Strip. D) Remove. Show Answer Correct Answer: B) Rstrip. 3. What is the function used to create a new directory in Python? A) Os.new dir(). B) Os.create dir(). C) Os.mkdir(). D) Os.make dir(). Show Answer Correct Answer: C) Os.mkdir(). 4. What will happen if you open a file in 'w' mode and write to it? A) It will append the data to the existing file. B) It will overwrite the existing file contents. C) It will read the file contents. D) It will delete the file. Show Answer Correct Answer: B) It will overwrite the existing file contents. 5. In which file the data is stored in ASCII and Unicode Characters? A) Binary File. B) Text File. C) Both (a) and (b). D) None of these. Show Answer Correct Answer: B) Text File. 6. What is a stream associated with in C programming? A) Database. B) Memory. C) File. D) Network. Show Answer Correct Answer: C) File. 7. What does the 'file handle' refer to in the context of opening a file? A) A tool to physically handle the file. B) A special variable that stores the file's data. C) A special variable that refers to the opened file. D) The user interface for managing files. Show Answer Correct Answer: C) A special variable that refers to the opened file. 8. What is the function of feof in file handling? A) To write data to the file. B) To read the contents of the file. C) To check if the file has reached the end. D) To determine if the file has been opened successfully. Show Answer Correct Answer: C) To check if the file has reached the end. 9. What does the 'close()' method do? A) Writes to a file. B) Reads a file. C) Closes a file. D) Opens a file. Show Answer Correct Answer: C) Closes a file. 10. Files are used by programs to store data needed for later use. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 11. The syntax of seek() is:file ..... object.seek(offset[.reference ..... point])what is the default value of reference ..... point? A) 0. B) 1. C) 3. D) 3. Show Answer Correct Answer: A) 0. 12. What does a cursor do in the context of file handling? A) It selects text within a document. B) It helps in connecting to the internet. C) It keeps track of the current location within the file when reading or writing. D) It controls the flow of data to the processor. Show Answer Correct Answer: C) It keeps track of the current location within the file when reading or writing. 13. What is the function of ftell()? A) Gets the current position of the file pointer. B) Checks for end of file. C) Deletes a file. D) Renames a file. Show Answer Correct Answer: A) Gets the current position of the file pointer. 14. Which operator is used to join Path objects in Python? A) +. B) . C) /. D) -. Show Answer Correct Answer: C) /. 15. Code executed based on a condition being true A) Sequence. B) Selection. C) Iteration. D) Variable. Show Answer Correct Answer: B) Selection. 16. To read the next line of the file from the object infi, we use A) Infi.read(all). B) Infi.read(). C) Infi.readline(). D) Infi.readlines(). Show Answer Correct Answer: C) Infi.readline(). 17. The data files can be stored in ..... ways. A) 1. B) 2. C) 3. D) 4. Show Answer Correct Answer: B) 2. 18. Joining elements together to make a string is called what? A) Combining. B) Connecting. C) Concatenation. D) Stringing. Show Answer Correct Answer: C) Concatenation. 19. In fob=open("fruits.txt", 'r'), fob refers to ..... A) File name. B) File object. C) File mode. D) File type. Show Answer Correct Answer: B) File object. 20. If a file is opened using the with statement, what is the main advantage? A) File reading and writing are faster. B) It makes exception handling complex. C) The file is automatically closed after leaving the block. D) The file doesn't need to be opened first. Show Answer Correct Answer: C) The file is automatically closed after leaving the block. 21. Choose the correct output from the options given below:#include struct st \{ int x; struct st next;\}; int main()\{ struct st temp; temp.x = 10; temp.next = temp; printf("%d", temp.next.x); return 0;\} A) Compiler error. B) 10. C) Garbage Value. D) Runtime error. Show Answer Correct Answer: A) Compiler error. 22. What is file handling in C++ programming? A) Method of handling exceptions in C++. B) Process of working with files. C) Technique for managing memory in C++. D) Approach for creating user interfaces in C++. Show Answer Correct Answer: B) Process of working with files. 23. Structure variable memory is allocated: A) During compile time. B) During run time. C) Static only. D) Never. Show Answer Correct Answer: B) During run time. 24. What is the purpose of closing a file in Python? A) Closing a file in Python is used to delete the file. B) Closing a file in Python is not necessary. C) Closing a file in Python is only required for text files. D) The purpose of closing a file in Python is to release resources and save changes. Show Answer Correct Answer: D) The purpose of closing a file in Python is to release resources and save changes. 25. Pri ispisu primjerice "Hello world" u datoteku pozdrav.txt preko objekta ispis, pravilno je zapisati: A) Cout<<"Hello world"< B) Pozdrav<<"Hello world"< C) Ispis<<"Hello world"< D) Txt<<"Hello world"< Show Answer Correct Answer: C) Ispis<<"Hello world"< ← PreviousNext →Related QuizzesClass 11 Computer Science Chapter 6 File Handling Quiz 1Class 11 Computer Science Chapter 6 File Handling Quiz 2Class 11 Computer Science Chapter 6 File Handling Quiz 3Class 11 Computer Science Chapter 6 File Handling Quiz 4Class 11 Computer Science Chapter 6 File Handling Quiz 5Class 11 Computer Science Chapter 6 File Handling Quiz 6Class 11 Computer Science Chapter 6 File Handling Quiz 7Class 11 Computer Science Chapter 6 File Handling Quiz 8Class 11 Computer Science Chapter 6 File Handling Quiz 9Class 11 Computer Science Chapter 6 File Handling Quiz 10 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books