a)
To prove whether the given statement is true or false.
a)
The given statement is True.
Explanation of Solution
Explanation:
The flow of control in
In procedural programming, the flow of control is same as the sequence in which the instructions and statements are written.
But in an object-oriented programming language, the flow of control differs due to function calls.
Conclusion:
Hence, in object-oriented programming paradigm also, the flow of control indicates the order in which statements execute in a program.
b)
To prove that the given statement is true or false.
b)
The given statement is False.
Explanation of Solution
Explanation:
The equality operator in C++ comprises of two equal symbols, that is, ==. The equality operator is used together with if statement in order to verify whether the values of two variables are equal or not.
The single equal symbol, =, is called the assignment operator which is used to assign values to variables.
Conclusion:
Hence, the given statement is False.
c)
To prove that the given statement is true or false.
c)
The given statement is False.
Explanation of Solution
Explanation:
When an if statement is written, the expression is written inside a pair of round brackets that does not ends with a semicolon. Whereas if the semicolon is placed after the expression in the if statement, it will not generate an expected result. Ending an if statement with a semicolon means ending the condition. It will check the condition but will end it in the same line and the logic will not be applied to the further statements.
Conclusion:
Hence, the given statement is False.
(d)
To prove that the given statement is true or false.
(d)
The given statement is False.
Explanation of Solution
Explanation:
An if statement should have a corresponding else or not is decided by the requirements of the program. If the program requires, then every if statement will have a corresponding else statement. Otherwise, if the program does not require, the if statement will not have a corresponding else part.
Whether an if statement will have a corresponding else part or not, is only decided by the program requirements and is not mandatory. A program will execute properly if only an if statement is written.
Conclusion:
Hence, the given statement is False.
(e)
To prove whether the given statement is true or false.
(e)
The given statement is False.
Explanation of Solution
Given statement:
The expression in the if statement:
if(score=30)
grade = ‘A’;
Explanation:
The expression inside the if statement assigns the variable score with a value of 30. The assignment statement is always True. Hence, in all the scenarios, the if statement will always evaluate to True and the grade variable will be assigned value ‘A’.
Conclusion:
Thus, the given statement is True.
(f)
To prove whether the given statement is true or false.
(f)
The given statement is True.
Explanation of Solution
Given statement:
The expression:
if(ch>=’A’ && ch<=’Z’)
Explanation:
The given if statement contains two conditions that are combined by “&&” operator. That is, when both the conditions are satisfied only then the if statement will evaluate to True.
For input ch<’A’, the first condition is not satisfied hence the if statement evaluates to False.
For input ch>=’Z’, both the conditions are satisfied only and only if ch=’Z’ but not for ch>’Z’.
Thus, for either of the inputs, the if statement evaluates to False.
Conclusion:
Hence, the given statement is True.
g)
To prove whether the given statement is true or false.
g)
The given statement is True.
Explanation of Solution
Given statement:
The given code is as follows.
cin >> num; if(num > 5) cout << num; num=0; else cout << “Num is zero” << endl;
Explanation:
In the given code, the if statement will be executed only when the input is greater than 5, otherwise the else statement will be executed.
The input for the given code is 5. Since the input is not greater than 5, the if statement will not be executed.
Here, for the input of 5, the else statement will be executed, and the output will be “Num is zero”.
Conclusion:
Hence, the given statement is True.
(h)
To prove whether the given statement is true or false.
(h)
The given statement is True.
Explanation of Solution
Explanation:
The result of a logical expression is either True or False. That is, a logical expression will always give a Boolean result.
A Boolean value can only be assigned to a Boolean variable but not to an int variable.
Conclusion:
Hence, the given statement is True.
(i)
To prove whether the given statement is true or false.
(i)
The given statement is True.
Explanation of Solution
Explanation:
The given expression is a combination of two statements. The first statement is x>0 which checks if the value of x is greater than 0. The second statement is “!” which inverts the result of the expression, x>0. It means that the “!” operator makes the expression as x<0.
Hence, the expression, x<0, can only be true for negative numbers.
Conclusion:
Thus, the given statement is True.
(j)
To prove whether the given statement is true or false.
(j)
The given statement is False.
Explanation of Solution
Explanation:
In C++, there are three logical operators. They are “&&”or AND operator, “||” or OR operator, and “!” or NOT operator.
The “!” operator is a logical operator.
The “!=” operator is an equality operator since it checks if one value is not equal to another value.
Conclusion:
Hence, the given statement is False.
(k)
To prove whether the given statement is true or false.
(k)
The given statement is True.
Explanation of Solution
Explanation:
In C++, there are four types of simple data types. They are integer, float, string, and boolean.
The expression in the switch statement is usually a variable. A variable can have any one of the simple data types.
In some cases when the switch contains an expression, the result of the expression can only evaluate to a value of the simple data type.
Conclusion:
Hence, the given statement is True.
Want to see more full solutions like this?
Chapter 4 Solutions
C++ Programming: From Problem Analysis to Program Design
- What are the steps you will follow in order to check the database and fix any problems with it and normalize it? Give two references with your answer.arrow_forwardWhat are the steps you will follow in order to check the database and fix any problems with it? Have in mind that you SHOULD normalize it as well. Consider that the database offline is not allowed since people are connected to it and personal data might be bridged and not secured. Provide three refernces with you answer.arrow_forwardShould software manufacturers should be tolerant of the practice of software piracy in third-world countries to allow these countries an opportunity to move more quickly into the information age? Why or why not?arrow_forward
- I would like to know about the features of Advanced Threat Protection (ATP), AMD-V, and domain name space (DNS).arrow_forwardPlease show the code for the Tikz figurearrow_forwardWhat is Windows Server and what is the Differences between Windows Server 2019 and the Windows Operating System that people have installed on their personal computer.arrow_forward
- solve and show the tree on paperarrow_forwardI need help to resolve the following activityarrow_forwardModern life has been impacted immensely by computers. Computers have penetrated every aspect of oursociety, either for better or for worse. From supermarket scanners calculating our shopping transactionswhile keeping store inventory; robots that handle highly specialized tasks or even simple human tasks,computers do much more than just computing. But where did all this technology come from and whereis it heading? Does the future look promising or should we worry about computers taking over theworld? Or are they just a necessary evil? Provide three references with your answer.arrow_forward
- What are the steps you will follow in order to check the database and fix any problems with it? Have in mind that you SHOULD normalize it as well. Describe in full, consider the following:• Taking the database offline is not allowed since people are connected to it.• Personal data might be bridged and not secured. Provide three refernces with you answerarrow_forwardYou are called by your supervisor to go and check a potential data bridge problem. What are the stepsyou will follow in order to check the database and fix any problems with it? Have in mind that youSHOULD normalize it as well. Describe in full, consider the following:• Taking the database offline is not allowed since people are connected to it.• Personal data might be bridged and not secured. Provide three refernces with you answerarrow_forward(A) A cellular system has 12 microcells with 10 channels per cell. The microcells are split into 3 microcells, and each microcell is further split into 4 picocells. Determine the number of channels available in system after splitting into picocelles.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,