C++ Programming(Computer Science ) Questions and Answers

Question 1. Which of the following is not used to seek a file pointer?
  1.    ios::cur
  2.    ios::set
  3.    ios::end
  4.    ios::beg
Explanation:-
Answer: Option B. -> ios::set
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 2. During dynamic memory allocation in CPP, new operator returns _________ value if memory allocation is unsuccessful.
  1.    False
  2.    NULL
  3.    Zero
  4.    None of these
Explanation:-
Answer: Option B. -> NULL
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 3. ________ are used to format the data display in CPP.
  1.    Iterators
  2.    Punctuators
  3.    Manipulators
  4.    Allocators
Explanation:-
Answer: Option C. -> Manipulators
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 4. We can create objects of the abstract class.
  1.    True
  2.    False
Explanation:-
Answer: Option B. -> False
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 5. By default, members of the class are ____________ in nature.
  1.    protected
  2.    private
  3.    public
  4.    static
Explanation:-
Answer: Option B. -> private
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 6. Which of the followings is/are pointer-to-member declarator?
  1.    ->*
  2.    .*
  3.    ::*
  4.    both a and b
Explanation:-
Answer: Option C. -> ::*
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 7. Reusability of the code can be achieved in CPP through ______ .
  1.    Polymorphism
  2.    Encapsulation
  3.    Inheritance
  4.    Both a and c
Explanation:-
Answer: Option C. -> Inheritance
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 8. Default value of static variable is_____ .
  1.    0
  2.    1
  3.    Garbage value
  4.    Compiler dependent
Explanation:-
Answer: Option A. -> 0
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 9. If a program uses Inline Function, then the function is expanded inline at ___________.
  1.    Compile time
  2.    Run time
  3.    Both a and b
  4.    None of these
Explanation:-
Answer: Option B. -> Run time
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!

Question 10. Which of the following is CPP style type-casting?
  1.    per = total/(float)m
  2.    per = total/float(m)
  3.    per = (float)total/m
  4.    None of these
Explanation:-
Answer: Option B. -> per = total/float(m)
NO EXPLANATION IS AVAILABLE FOR THIS QUESTION!