When the body of an if contains multiple statements, these statements must be pl
ID: 3872344 • Letter: W
Question
When the body of an if contains multiple statements, these statements must be placed in a. () parentheses b. [] brackets c. angle brackets 35. d. ( braces e. none of the above 36. Suppose p and q have been declared as boolean variables. Which of the following expressions would always evaluate to true? e. none of the above 37. What is the value of the expression below if a- 2,b-5, and c-4: a. true (1) b. 2 e. none of the above c. false (O) According to Dr. Quick's definition of types of errors a. syntax errors b. grammar errors c. run-time errors test data is used to find d. logic errors e. none of the above 38. Short Answer: There are 6 short answer questions in this portion of the exam. You may assume that all the necessary library files have been included. Make sure your answers are legible. The point value of each question is given. Do not use loops or any concepts beyond Chapter 4 of textbook. Only write what is necessary to complete the code segment as described. 39. Rewrite the following algebraic equation as a single valid C++ assignment for s(you may assume all variables (H y, q and w) have been declared and assigned values). (6 points) Assuming x has been defined (declared) ealier as an int, is the following statement valid or invalid? invalid explain why. (5 points) 40. If it is 7.542 -xExplanation / Answer
35) If the If statement contains multiple statements then we use the curly braces"{ }". if we don't use curly braces then if statement takes the only statement which is just after if condition and other statements will not execute under if statement.
Answer:--> (d)
36)if we have initialized p and q to true then option(a) and (d) will always return true.
37)a=2, b=5, and c= 4
a*b-c will evaluate to 2*5 -4=6
and the condition a*b-c >b i.e.; 6>5, which is true
So answer is (a)
38)logic errors
39) H= sqrt( 4*q*w -y);
40) It is an invalid expression. Since the value to be assigned to a variable must be on right side of an assignment(=) operator.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.