Questions : answer True (T) or False (F) #1: An identifier can be any sequence o
ID: 3564585 • Letter: Q
Question
Questions : answer True (T) or False (F)
#1: An identifier can be any sequence of digits, letters, and the underscore
character.
#2: You can use the function getline to read a string containing blanks
(whitespaces).
#3: Suppose a = 10; After the execution of ++a, the value of a is 11.
#4: The expression !(x < 0) is true only if x is a positive number.
#5: After the execution of the following code, sum = 15?
sum = 0;
num = 10;
if (num > 0)
sum = sum + 10;
else if (num > 5)
sum = num + 15;
#6: After the execution of the following code, is the output
Explanation / Answer
1) False, An identifier can contain any digits,letters or underscore symbol but it must start with a letter or an underscore symbol.
2) True, getline function in c++ reads all the line but it doesn't consider like whitespaces,....
3) True, ++a is preincrement operator so first a value incremented and then it is assigned to a..
4) True, For any positive value in place of x becomes false so the true value will come as not symbol specifies alternative to the result.
5) False, sum value will be 10 only as because num value is greater than zero, so sum value will be 10 as 10 is added to sum.
6) False, the output should be 7 4 11.
7) True, according to the priority, and operator get execute first so false and later or operator will get execute so false or false is false.
8) True, 0 or 1 is binary digits called bits.
9) True, selection control structures like if, if-else and switch; all must be worked on a condition..
10) False, first 15/2 value is assigned i.e. 7 then converting into double.
11) False, the output will be 1 2 3 4.
12) True, the output will be 1 2 3 4 5 6 7 8 9 10 .
13) True, do-while loop executes atleast once as the condition is checked at the end of the loop..
14) True.
15) True, an infinte loop is a never ending loop.
16) true, both conditions are true.
17) False, the output must be 10 8 6 4 .
18) True, here subscript can be any but values should be given when no value is assigned.
19) False, + sign is for public.
20) False, global variables can be used by any method but all methods should be called by main method only.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.