Search Header Logo
DCS1101 - Week 4 (Conditions)

DCS1101 - Week 4 (Conditions)

Assessment

Presentation

•

Computers

•

University

•

Practice Problem

•

Easy

Created by

Yasmin Basiran

Used 7+ times

FREE Resource

30 Slides • 17 Questions

1

Week 4 - Conditions
media

Making decisions and program flow

2

media

3

Draw

Last week, we used flowcharts. Which symbol represents a process?

4

Poll

When you make a decision, do you always have all the information you need?

Yes

No

5

Poll

Can a good decision still lead to a bad outcome?

Yes

No

6

7

Multiple Choice

According to the video, what defines a good decision?

1

The result is always successful

2

The decision uses available information logically

3

The decision avoids risk completely

4

The decision avoids risk completely

8

Multiple Choice

Why is long-term thinking important in programming?

1

Code never changes

2

One mistake ends a program

3

Programs run only once

4

Learning improves through repeated decisions and fixes

9

media

10

media

11

media

12

Multiple Choice

In a problem analysis chart, where do decisions usually belong — input, process, or output?

1
process
2
output
3
input

13

media

14

media

15

Multiple Choice

What is the result of this expression?

10 < 5

1
false
2
true
3
5 < 10
4
10 > 5

16

media

17

media

18

media

19

media

20

Open Ended

If marks = 45, what will be printed?

if (marks >= 50)

cout << "Pass";

else

cout << "Fail";

21

media

22

media

23

Open Ended

Why might one condition not be enough in real-life problems?

24

media

25

media

26

media

27

media

28

media

29

media

30

media

31

media

32

media

33

media

34

media

35

media

36

media

37

media

38

media

39

Multiple Choice

[HOTSPOT] What is the output?

int mark = 48;

if (mark >= 50)

cout << "Pass";

else

cout << "Try Again";

1
Try Again
2
Compilation Error
3
No Output
4
Pass

40

Open Ended

Find the error of this code:

int score = 75;

else (score == 75) {

cout << "Exactly 75";

}

41

Fill in the Blanks

[HOTSPOT] A cinema gives a student discount when the customer's age is 18 or below.

Complete the condition:

if (​ ​

Type answer...

) {

cout << "Student Discount";

}

42

Multiple Choice

Which condition checks whether age is at least 20?

1
age <= 20
2
age >= 20
3
age > 20
4
age == 20

43

Multiple Choice

[HOTSPOT] What is the output of this code?

int number = 7;

if (number % 2 == 0)

cout << "Even";

else

cout << "Odd";

1
Even
2
Odd
3
7
4
Error

44

Multiple Choice

[HOTSPOT] What is the error of this code?

int score = 80;

if (score = 80)

cout << "Excellent";

1
if (score == 80)
2
if (score > 80)
3
if (score != 80)
4
if (score = 80)

45

Multiple Choice

Which condition checks whether age is between 18 and 60 inclusive?

1
age > 18 && age < 60
2
age > 18 && age <= 60
3
age >= 18 && age <= 60
4
age >= 18 || age <= 60

46

Draw

Draw the flowchart for the following code:

if (mark >= 50)

cout << "Pass";

else

cout << "Fail";

47

media
pattern-tertiary
Week 4 - Conditions
media

Making decisions and program flow

Show answer

Auto Play

Slide 1 / 47

SLIDE