250+ TOP MCQs on Stored Sequences and Answers

This section on online C++ test on “Stored Sequences”. One shall practice these test questions to improve their C++ programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C++ programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our online C++ test questions come with detailed explanation of the answers which helps in better understanding of C++ concepts.

Here is a listing of online C++ test questions on “Stored Sequences” along with answers, explanations and/or solutions:

1. What is meant by sequence point?
a) Represent the point of execution in the program
b) Represent the whole program
c) Represent the beginning of the program
d) Represent the end of the program
Answer: a
Clarification: A sequence point defines any point in a computer program’s execution at which it is guaranteed that all side effects of previous evaluations have been performed.

2. Pick out the correct statement about sequence point.
a) Sequence point will compile the program
b) Sequence point will resolve all the side effects
c) Sequence point will save the program for execution
d) Sequence point will delete the program for execution
Answer: b
Clarification: Sequence point is a point in time at which the dust has settled and all side effects which have been seen so far are guaranteed to be complete.

3. In sequence point, how will the overloaded operators behave like?
a) Function
b) Objects
c) Instance variable
d) Container

Answer: a
Clarification: In sequence point, the overloaded operators behave like a function.

4. What do input and output objects support?
a) Terminated sequences
b) Extracted sequences
c) Null-terminated sequences
d) Terminated & Extracted sequences
Answer: c
Clarification: cin and cout support null-terminated sequences as valid containers for sequences of characters.

5. What kind of execution does sequence point allow?
a) Non-overlap
b) Overlap
c) Concurrent
d) Sequence
Answer: a
Clarification: To resolve all the side-effects in the program, the sequence point should not be overlapped.

6. What will be the output of the following C++ code?

  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         string mys;
  7.         char mya[20]= "Hello world";
  8.         mys = mya;
  9.         cout << mys << 'n';
  10.         return 0;
  11.     }

a) Hello world
b) Hello
c) Error
d) Runtime error
Answer: a
Clarification: In this program, We converted the char values into the string.
Output:

$ g++ sts.cpp
$ a.out
Hello world

7. What will be the output of the following C++ code?

  1.     #include 
  2.     #include 
  3.     #include 
  4.     using namespace std;
  5.     bool IsOdd (int i) 
  6.     {
  7.         return (i % 2) == 1; 
  8.     }
  9.     int main () 
  10.     {
  11.         vector<int> myvector;
  12.         for (int i = 1; i < 10; ++i) myvector.push_back(i);
  13.         vector<int> :: iterator bound;
  14.         bound = partition (myvector.begin(), myvector.end(), IsOdd);
  15.         for (vector<int> :: iterator it = myvector.begin(); it != bound; ++it)
  16.             cout << ' ' << *it;
  17.         return 0;
  18.     }

a) 1 3 5
b) 1 3 9
c) 1 9 3 7
d) 1 9 3 7 5
Answer: d
Clarification: In this program, We are finding the odd values in the sequence.
Output:

$ g++ sts1.cpp
$ a.out
1 9 3 7 5

8. When does the next sequence point start?
a) At the beginning
b) After a terminating semicolon
c) It is a beginning statement
d) At the end
Answer: b
Clarification: After a terminating semicolon the next sequence point start.

Global Education & Learning Series – C++ Programming Language.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top