The following 4 lines of C++ code, use strings. string firstName; // Define a string object
Char lastName[7]; // Define a C-string
FirstName = "Abraham"; // Assign a value to the string object
LastName = "Lincoln"; // Assign a value to the C-string
Which of the following statements is /are True?
A) The string object is defined incorrectly because no size is given for it.
B) The 2 string definitions are correct, but the 2 assignment statements are wrong.
C) The string object is assigned a value correctly, but the C-string is not.
D) The C-string is assigned a value correctly, but the string object is not.
E) All 4 lines of code are correct.
Correct Answer:
Verified
Q23: When a C++ expression is evaluated, binary
Q24: The following two expressions evaluate to the
Q25: The cin object lets the user enter
Q26: If the value of dollars is 5.0,
Q27: In C++, the 5 basic arithmetic operators
Q29: Operator associativity is either left to right
Q30: The following pair of C++ statements will
Q31: When converting some algebraic expressions to C++,
Q32: The following statement sets the value of
Q33: The _ object causes data to be
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents