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
    (Programming Paradigm)(Characteristic)
    A.ImperativeI.Declarative, clausal representation, theorem proving
    B.Object‐orientedII.Side‐effect free, declarative, expression evaluation
    C.LogicIII. Imperative, abstract data type
    D.FunctionalIV.Command‐based, procedural

    Choose the correct answer from the options given below :

  2. Let A be the base class in C++ and B be the derived class from A with protected inheritance. Which of the following statement is false for class B?

  3. A member function can always access the data in _______, (in C++).

  4. Which of the following is not correct for virtual function in C++?

  5. Which of the following is correct (in C++)?

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