C++ multiple choice questions for study guide. Need help so I can make sure I am
ID: 3919672 • Letter: C
Question
C++ multiple choice questions for study guide. Need help so I can make sure I am studying correct material.
Any help would be greatly appreciated! I am also posting a few more multiple choice questions and programs right now so check them out. Thanks!
Question 21 1 pts Question 26 1 pts Consider the following code: int x-10. y 11 if (x10 Which of these data types can be put into an array b. char Student cbjects else y- d all of the abowe Which of these statements is TRUE after this code executes? x has a value of 10, and y has a value of 11 x hasa value of 11, and y has a value of 10 xhas a value of 11, and y has a value of 11 O x has a value of 10, and y has a value of 10 Question 27 An array of characters amounts to a ? ac-string b. Standlard C+ string Question 22 1 pts Consider the following code: float price [100): Which of the following loop headers would be appropriate for looping through this array Question 28 1 pts The last character in a c-string is aways all of the above are equally appropriate Question 23 1 pts Which of these lines of code will result in a two-dimensional anay? Question 29 1 pts int twoD MAX: int twoDROWS ICOLS: int twoD-ROWS, COLS). Which of these header files must you include if you want to copy a c-style string into another (empty) c-style string? none of the above a string cstring Question 24 1 pts cboth a and b none of the above Which of these header files should you include if you want to format a number currency style? fie two decimal places Question 30 1 pts e conio h lomanip iostream Oprocess.h You are writing a program during the execution of which a user will type in his or her full name Iirst and last separated by a spacel.The name will then be placed in a Standard C++ string. Which of these lines of code will work best? Assume that "name" is name of the string cin getíname, 80 Question 25 1 pts cin>>name getincicin, namel: Consider the following function declaration: float calc taxlfloat, float[): Which of the following is TRUE? all of the above will work oqually well O this function accopts an anray as an argument this function accopts a simple variable as an argument this function retums a float all of the above are trueExplanation / Answer
If you post more than 1 question, as per chegg guidelines I have to solve only first question.
Ques 21. Answer : (d)
The else block executes as
x = 10
So,
x >= 10
So,
y--
y = 11 - 1
y = 10
Also
x = 10
Ques 22. Answer : (a)
In the option (b), the condition inside the for loop is
i < price
and
i <= price
But price is not an int, but rather int *. So, they will cause error.
Ques 23. Answer : (b)
The correct syntax to declare 2D array is
data_type name_of_array[ number_of_rows ][ number_of_columns ];
Ques 24. Answer : (b) iomanip
#include<iomanip>
The above header consists of the function for formatting the data like
There are also other formatting methods.
Ques 28. Answer : (b) ''
In a c-string, the last character is the '' which marks the end of the string.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.