C++11 (2 points) Given that an integer named x has been declared, which of the f
ID: 3910908 • Letter: C
Question
C++11
(2 points) Given that an integer named x has been declared, which of the following lines of code will NOT compile? (a) const int ref x; (b) const int ref-5; (c) const int 8ref 5; (d) const int &&ref; x; (e) They will all compile (f) (b) & (d) (g) None of them will compile (2 points) Given that an integer named x has been declared, which of the following lines of code will NOT compile? (b) int &ref; 5; (c) int &&ref; 5; (d) int refx; (e) They will all compile (f) (b) & (d) (g) None of them will compileExplanation / Answer
Ques 1.
Answer : (d) int &&ref = x
It is because we cannot bind a reference of type 'const int&&' to a of type 'int'
Ques 2.
Answer : (f) (b) & (d)
(b) It is because we cannot bind non-const reference of type 'int&' to a value of type 'int'
(d) It is because we cannot bind reference of type 'int&&' to a value of type 'int'
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.