Explore topic-wise MCQs in Csharp.

This section includes 14 Mcqs, each offering curated multiple-choice questions to sharpen your Csharp knowledge and support exam preparation. Choose a topic below to get started.

1.

What are Random-access Iterators?

A. Iterators that can be used to access elements at an arbitrary offset position
B. Same as Bi-directional iterator
C. Input iterator with the additional property of random access
D. Output iterator with the additional property of random access
Answer» B. Same as Bi-directional iterator
2.

What are Bi-directional iterators?

A. Iterator same as Forward Iterator
B. Forward Iterator that can be used in both directions
C. Iterator that can only be used to access the sequence from both sides
D. Iterator that can only be used to assign the sequence from both sides
Answer» C. Iterator that can only be used to access the sequence from both sides
3.

Which of the following is an advantage of Forward iterator over input and output iterator?

A. Can be used as both accessing and assigning iterator
B. Forward iterator can be incremented or decremented
C. Can be used with relational operators also
D. Can be used with arithmetic operators also
Answer» B. Forward iterator can be incremented or decremented
4.

If i1 is Input Iterator and i2 is Output Iterator, then which of the following things are correct?

A. i and ii
B. i only
C. i, ii and iv
D. iii and ivView Answer
Answer» C. i, ii and iv
5.

What type of Iterator i1 is in the following C++ code snipet?

A. Input Iterator
B. Output Iterator
C. Both Input and Output Iterator
D. Neither Input nor Output IteratorView Answer
Answer» C. Both Input and Output Iterator
6.

Which of the following is correct about Input Iterators?

A. Input iterators can be used with all relational operators
B. Input iterators can work with arithmetic operators
C. No value can be assigned to the location pointed by Input Iterator
D. Input iterators can work with sequence operators
Answer» D. Input iterators can work with sequence operators
7.

Pick the correct statement.

A. Input iterator moves sequentially forward
B. Input iterator moves sequentially backward
C. Input iterator moves in both direction
D. Input iterator moves sequentially downwards
Answer» B. Input iterator moves sequentially backward
8.

How many types of Iterators are there?

A. 5
B. 2
C. 3
D. 4
Answer» B. 2
9.

Which function is used increment the iterator by a particular value?

A. next()
B. advance()
C. prev()
D. move()
Answer» C. prev()
10.

What are Iterators?

A. STL component used to point a memory address of a container
B. STL component used for vectors
C. STL component used to call functions efficiently
D. STL component used to define template classes
Answer» B. STL component used for vectors
11.

2_8_5_1?$

A. 1 5 8 2
B. 2
C. 2 1 8 5
Answer» C. 2 1 8 5
12.

CODE_RUN_SUCCESSFULLY_PRINTS_NOTHING?$

A. A B C D E F G H I J K L M N O P Q R S T U V
B. U T S R Q P O N M L
C. Compile time error
Answer» D.
13.

A B C D E F G H I J K L M N O P Q R S T U V

A. Run time error
B. U T S R Q P O N M L K J I H G F E D C B A
C. Compile successfully prints nothing
Answer» C. Compile successfully prints nothing
14.

Definition of iterator for MyClass

A. Implements the GetEnumerator() method defined by IEnumerable
B. The yield return statement returns the next object in the collection, which in this case is the next character in chrs
C. All of the mentioned
Answer» D.