MCQ and T (Or) F C++
MCQ and T (Or) F C++
MCQ and T (Or) F C++
1. A relational operator compares two values and the results can either be true or false.
Ans: True
3. The for loop contains three expressions: the initialization expression, the _________ expression, and the
increment/decrement expression.
Ans: test
5. In _____ loop, the test expression is placed at the end of the loop.
A. for
B. while
C. do
Ans: C
6. The exit() function causes the C++ program to terminate.
Ans: True
7. The value of alpha is 5 and beta is 2 then output the value for min.
min=(alpha<beta)?alpha:beta;
Ans: 5
8. ________ operators combine two or more relational operators or expressions.
A. Relational
B. Logical
C. Arithmethic assignment
Ans: B
9. The break statement stops the execution of the outermost loop.
Ans: False
10. The continue statement takes to the top of the loop when something unexpected happens.
Ans: True
1. The main difference between structure and array is that arrays are collection of the different data type
and structure is a collection of same data types. (False)
2. Structures are built-in data types. (False)
3. A structure definition creates space in memory for a variable. (True)
4. Structure is declared by using keyword struct followed by structure name called tag. (True)
5. Enumeration is user defined type which is used to assign names to integral constants. (True)
6. When accessing a structure member, the identifier to the left of the dot operator is the name of ______.
(a) a structure member (b) a structure tag
(c) a structure variable (d) the keyword struct.
7. An enumeration brings together a group of _____.
(a) items of different data types (b) integers with user-defined names
(c) related data variables (d) constant values
8. The first three enumerators of an enum type are normally represented by the values.
(a) 0 (b) 1 (c) 2 (d) 3
9. Internally the compiler treats enumeration variables as ______.
(a) string (b) character (c) integer (d) float
10. the structure members can be accessed by using member access operator also called _____ operator.
(a) reference (b) dereferencing (c) insertion (d) dot
1). Which of the following is used to terminate the function declaration in C++?
a) ;
b) ]
c) )
d) :
A. Randomly
B. Sequentially
C. Both of them
D. None of above
A. A first-in-first-out approach
B. The dot operator
C. A member name
D. An index
A. Index
B. Array name
C. Size
D. Element
A. Same
B. Different
C. Either same or different
D. Neither same nor different
6. If you want to store the values in the form of the list, which type of array you can use :
d) y is a pointer to a string
3. What will be the output of the following C++ code?
int main() {
int a = 5, b = 10, c = 15;
int *arr[] = {&a, &b, &c};
cout << arr[1];
return 0;
}
a) 5
b) 10
c) 15
a) True
b) False
a) Binary
b) Text
c) Can’t say
2. It is not possible to combine two or more file opening mode in open () method.
a) True
b) False
5.Which function is used in C++ to get the current position of file pointer in a file?
a) ftell()
b) get_pos()
c) get_p()
d) tell_pos()
6. Which of the following is used to move the file pointer to start of a file?
a) ios::beg
b) ios::start
c) ios::cur
d) ios::first
7. It is not possible to combine two or more file opening mode in open () method.
a) True
b) False
c) May be
d) None of these
b) Returns true if a file open for reading has reached the next word.
c) Returns true if a file open for reading has reached the end.
d) Returns true if a file open for reading has reached the middle.
9. Which of the following true about FILE *fp
a) FILE is a structure and fp is a pointer to the structure of FILE type
d) FILE is a stream
a) >>
b) <<
c) <
d) None of the above