You are on page 1of 7

CE0002L

(Computer Fundamentals and Programming)

SUMMATIVE

6
SELECTION STRUCTURES

Escoto, John Henry A. Abraham Magpantay


October 26, 2020 October 26, 2020
I. OBJECTIVES

At the end of the experiment, students must be able to:


a) understand the logic of using flow controls.
b) understand how to use flow controls.
c) identify the difference between the different flow controls.
d) construct a program using flow controls.
e) compile and debug the error of the program
f) appreciate the concept behind this experiment

II. BACKGROUND INFORMATION

 if-else() performs statements based on two conditions


 switch() performs statements based on multiple conditions

III.PROCEDURE:

1. Get three exam grades from the user and compute the average of the grades. Output the
average of the three exams. Together with the average, also include a smiley face in the
output if the average is greater than or equal to 60, otherwise output :-(.

2. Write a C program that will read in month and day (as numerical value). The program will
return the equivalent zodiac sign.

Sample output:
Enter month: 6
Enter day: 25
Zodiac sign for June 25 is Cancer
3. Write a switch statement that assigns to the variable lumens the expected brightness of a
standard light bulb whose wattage has been stored in watts.

Use this table:

Watts Brightness (in Lumens)


15 125
25 215
40 500
60 880
75 1000
100 1675

Assign –1 to lumens if the value of watts is not in the table."

IV. QUESTION AND ANSWER

1. What is the significance of using control structures?


Control structures allow the program to process decisions based on the set conditions of
the programmer. It permits the understanding of multiple statements and choose an output
that corresponds with the parameters given by the programmer.

2. For you, which is is preferably the most convenient control structure to be used in
comparisons, IF-ELSE or SWITCH?
I will choose the “IF – ELSE” control structure since this is much simpler than the latter.

3. Do SWITCH and IF-ELSE have differences?


In its function, these control structures are the same because they both process multiple
conditions in a given setup. Their difference is the type of condition they process, “IF –
ELSE” structure usually process statements that have variable conditions while the
“SWITCH” structure usually process statements or conditions that have fixed values.
Task 1:
Task 2:
Task 3:
V. ASSESSMENT

Department Computer Science Department


Subject Code CE0002L
Description Computer Fundamentals and Programming
Term/Academic Year 1 / 2020-2021

Topic Selection Structures


Lab Summative 6
No.
Lab Summative Selection Structures
CLO 2,3,4

Note: The following rubrics/metrics will be used to grade students’ output in the Lab
Summative 5.

Criteria Descriptions Points


Selection statements The program uses correct code for for 20
if, if-else, if-else-if, switch or break.
Syntax of the program The source code is written in correct 20
syntax and semantics
Use of code The use of selection structures are 30
appropriate for the problem
Error in the program The program made is free of errors and 15
bugs.
Output The output of the program is correct 15
and solved based on the problem
stated.
Total 100%

You might also like