Question

In: Computer Science

By using examples differentiate between a single‐alternative and a dual‐ alternative if statement. 8 marks

By using examples differentiate between a single‐alternative and a dual‐ alternative if statement. 8 marks

Solutions

Expert Solution

Single Alternative If statement :- This is the simplest version of if statement.Single alternative if statement is the statement in which it provides only one alternative path of execution. If condition is true, some process is executed, but if condition is not true,exit the structure.

For example:- If(I having fishing pole) then I am going to fishing.
Note:- In the above example, it tells you what to do if the condition is true, but on the other hand it does not tells you what to do if the condition is false.

Flow chart of Single Alternative If Statement:-

Dual Alternative If statement :- Dual alternative If statement is also known as IF then ELSE. Dual alternative if statement provides two alternative path of execution i.e. there is an action (statement to be executed) on the true branch as well as on the false branch. Hence, if the if-condition is false, there is alternative statement to execute i.e. Else Statement which was not the case in the single alternative if statement.

For example :- If (x>10) then print "Greater than 10" else print "smaller".
Note :- Here it tells you what to do if the condition is true as well as if the condition is false.

Flow chart of Dual Alternative If Statement :-


Related Solutions

Define, compare, and contrast, using examples, the terms single-alternative selection and dual-alternative selection In Javascript
Define, compare, and contrast, using examples, the terms single-alternative selection and dual-alternative selection In Javascript
Using appropriate examples (i) differentiate between structured and unstructured data (ii) discuss the need for alternative...
Using appropriate examples (i) differentiate between structured and unstructured data (ii) discuss the need for alternative techniques of data analysis between the two
differentiate between the single rate method and dual-rate method of cost allocation based on the usage...
differentiate between the single rate method and dual-rate method of cost allocation based on the usage of resource
Differentiate between procedures and work instructions. Identify in the article both the descriptions. [8 marks]
Differentiate between procedures and work instructions. Identify in the article both the descriptions. [8 marks]
(a) Giving examples in each case differentiate between the following concepts:     Single and complex economies...
(a) Giving examples in each case differentiate between the following concepts:     Single and complex economies Underdeveloped and developing economies     Underemployment and unemployment     Economic growth and economic development       (b)    Why is economics central to an understanding of the problems of development?
QUESTION 1 Using relevant examples, outline four differences between financial accounting and management accounting. (8 marks)...
QUESTION 1 Using relevant examples, outline four differences between financial accounting and management accounting. QUESTION 2 a. Explain how an organisation’s growth objective may conflict with its profit objective. b. Describe three alternative objectives that an organisation might have other than growth and profit. QUESTION 3 Various stakeholders require different types of information from the financial statement of an organisation. From the following list, identify which user category would most likely be served better by the information and give at...
1. Differentiate between the insurance of indemnity and compensation 2. With vivid examples, differentiate between a...
1. Differentiate between the insurance of indemnity and compensation 2. With vivid examples, differentiate between a debtor and a creditor as it affects the mortgage. 3. Discuss the meaning of Bankruptcy a. What are the types of bankruptcy b. In Canada, what type of court handles bankruptcy matters and why
Distinguish the differences between stock splits and stock dividends in paragraph with examples. (8 marks)
Distinguish the differences between stock splits and stock dividends in paragraph with examples.
Distinguish the differences between stock splits and stock dividends in paragraph with examples. (8 marks)
Distinguish the differences between stock splits and stock dividends in paragraph with examples.
The second facilitator has elaborated on software. a. Using suitable examples, differentiate between system software and...
The second facilitator has elaborated on software. a. Using suitable examples, differentiate between system software and application software b. Describe three (3) major categories of system software. c. Using appropriate examples, describe three (3) types of interfaces that are commonly used. d. Compare and contrast between Workgroup Applications and Enterprise Applications. The final session of the workshop was focused on Artificial Intelligence (AI). Over the last decade, AI has grown from a pipe dream into the driving force behind the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT