Name: You have questions on both Sides. ENGR203 Quiz 3 1. Suppose that x, the fo
ID: 3733803 • Letter: N
Question
Name: You have questions on both Sides. ENGR203 Quiz 3 1. Suppose that x, the following statements (15') y, z and w are int variables, and x-9, y-8, z 1 and w#7, what is the output of 2. Which of the following are logical (Boolean) operators? (5') 3. Which of the following are relational operators? (5') d. =! True or False (15') a. The result of a logical expression cannot be assigned to an int variable b. In C++, both ! and != are logical operators. c. Every if statement must have a corresponding else. d. The expression ! (x>0) is true if x is a negative number. e. In a one-way selection, if a semicolon is placed after the expression in an if statement, the 4. expression in the if statement is always true. Evaluate the following expressions true or false a. 5+6-3+7 b. 2*6-4>-9-1 5. (20') e. 6.28/310) 6. (20") 11 (z-2 != 28) 7. Suppose that str1, str2, and str3 are string variables, and str1-"English", str2-"Computer Science", and str3-"Programming". Evaluate the following expressions true or false. (10') b. stri >-str2 c. str3 str2 8. Write the meaning of the following operators (10') b. 88-Explanation / Answer
Following is the answers:
1)
a) False
b) True
c) True
2)
a,d,e
Logical OR = e = ||
Logical AND = d = &&
Logical NOT = a = !
3)
a,b
Relational lessthen = a = <
Relational lessthen or equal to = b = <=
4)
a.False(you can assign a logical expression to int.)
b.False (Only != is Logical Operator.)
c.False (You can only assign if statement.)
d.True (because First x>0 is false but ! is opposite the output so it's true.)
e.False
5)
a.False
b.True
c.False
d.False
e.False
6)
b.True
c.False
d.True
e.True
f.True
7)
b.False(According to string size)
c.True(According to string size)
8)
a.!= -> Not Equal
b.&& -> Logical AND
c.|| -> Logical OR
d.== -> Equals To
e.! -> Logical NOT
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.