All Exams Test series for 1 year @ ₹349 only
Question

Match the LIST-I with LIST-II
LIST-I (file mode parameters)LIST-II (Meaning)
A. ios::ateI. Go to end of file on opening
B. ios::inII. Open fails if the file already exists.
C. ios::nocreateIII. Open file for reading only
D. ios::noreplaceIV. Open fails if the file does not exist.
Choose the correct answer from the options given below:

The correct answer is
A-I, B-III, C-IV, D-II

Matching C++ File Mode Parameters

Understanding the File Stream Parameters

This question requires matching C++ file stream opening mode parameters (LIST-I) with their corresponding meanings (LIST-II). These parameters control how a file is opened and accessed.

Parameter Meanings

  • ios::ate: Sets the initial position of the file pointer to the end of the file upon opening.
  • ios::in: Specifies that the file is to be opened for reading (input operations).
  • ios::nocreate: If the file specified does not exist, the open operation fails.
  • ios::noreplace: If the file specified already exists, the open operation fails.

Correct Matching

Based on the definitions, the correct pairings are:

  • A. $ios::ate$ matches with I. Go to end of file on opening.
  • B. $ios::in$ matches with III. Open file for reading only.
  • C. $ios::nocreate$ matches with IV. Open fails if the file does not exist.
  • D. $ios::noreplace$ matches with II. Open fails if the file already exists.

Solution Summary Table

LIST-I LIST-II
A. ios::ate I. Go to end of file on opening
B. ios::in III. Open file for reading only
C. ios::nocreate IV. Open fails if the file does not exist
D. ios::noreplace II. Open fails if the file already exists

Therefore, the correct combination is A-I, B-III, C-IV, D-II.

Was this answer helpful?

Important Questions from OOPs concept

  1. Match List I with List II
    List IList II
    A. OverloadingI. Since function call is resolved during run time, the execution is Slow.
    B. Early bindingII. Since function call is resolved during compilation time, the execution is much faster.
    C. OverridingIII. Supports compile-time polymorphism.
    D. Late BindingIV. Supports run-time polymorphism.

    Choose the correct answer from the options given below:
  2. Which among the following best describes polymorphism ?
  3. Which operator is used for dynamic memory allocation in C++?

  4. Which of the following is not true about constructor
  5. Which one of the following is correct, when a class grants friend status to another class ?
Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App