CPP Goto Statement MCQ
Cpp MCQ- Home
- Tutorials
- Cpp
- Goto Statement
- Multiple Choice Question
(1) Label indentifier in goto statement always place _____ goto statement.
A) After
B) Before
C) Before main function
D) After main function
Explanation
Label identifier is always place before goto statement. This label identifier followed by semi colon.
(2) Which of the following is valid goto statement syntax ?
A) goto (label)
B) goto {label}
C) goto label;
D) goto label:
Explanation
The exact syntax of goto statement in C++ involve goto keyword and label identifier ends with semicolon.
(3) How many labels are used in single goto statement?
A) 1
B) 2
C) 3
D) 4
Explanation
Only single identifier is used in single goto statement implementation.
(4) In C++ how many identifiers are required to implement goto statement?
A) 1
B) 2
C) 3
D) 4
Explanation
In C++ one identifier called label is required to implement goto statement.
(5) Which of the following statement can also be used to implement iteration?
A) if
B) if else
C) goto
D) switch
Explanation
We can also iteration with the help of goto label statement.
(6) Which of the following operator is used after label in goto statement?
A) Colon :
B) Semi colon ;
C) Dot .
D) Comma ,
Explanation
In goto statement colon is used after label statement.
(7) Which of the following is used for unconditional control transfer?
A) if
B) switch
C) for
D) goto
Explanation
Goto statement is used to move unconditional control to specific line in the program. This point is called label. To define a label in C/C++ colon is used after label identifier. Label can be defined anywhere in the program.
.