Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 234 - 235 of 354

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 234

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is a mixin class?

Explanation

  • A class that provides some but not all of the implementation for a virtual base class is called mixin.
  • Derivation just for redefining the virtual functions in the base classes is called mixin inheritance.
  • Mixin classes typically don՚t share common bases.
Given the Image is a Mixin in C ++ Example

Question 235

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What will be the position of the file marker?

a: Fseek (ptr, 0, SEEK_SET) ;

b: Fseek (ptr, 0, SEEK_CUR) ; Answer: a: The SEEK_SET sets the file position marker to the starting of the file.

b: The SEEK_CUR sets the file position marker to the current position of the file.

Explanation

  • Fseek () function is used to move file pointer position to the given location

    Declaration: int fseek (FILE ⚹ fp, long int offset, int whence)

    Where,

    • fp - file pointer.
    • offset - Number of bytes/characters to be offset/moved from whence/the current fie pointer position.
    • Whence - this is the current file pointer position from where offset is added
  • A: it is used to set the pointer from the starting position

    Ex: Fseek (ptr, 10, SEEK_SET) ;

    Here, the pointer going to point the 10th position from starting position.

  • B: it is used to set pointer position from the current position.

Ex: Fseek (ptr, 10, SEEK_CUR) ;

Here, the pointer going to point the 10th position from the current position.

Developed by: