Search Header Logo
CSDC101 - Control Structure 1

CSDC101 - Control Structure 1

Assessment

Presentation

Other

University

Medium

Created by

Joshua Martinez

Used 4+ times

FREE Resource

55 Slides • 15 Questions

1

CSDC101 - Control Structures 1

Sequence | Selection | Repetition

Slide image

2

Slide image

3

Slide image

4

Slide image

5

Slide image

6

Slide image

7

Slide image

8

Slide image

9

Slide image

10

Slide image

11

Slide image

12

Slide image

13

Slide image

14

Multiple Choice

int x = 0;


cin >> x;

cout << xx << endl;


The statement above is an example of what control structure?

1

Sequence

2

Selection

3

Repetition

15

Slide image

16

Slide image

17

Slide image

18

Slide image

19

Slide image

20

Slide image

21

Multiple Choice

What is the output of the logical expression below?


(true || false) && (!true || !false)

1

true

2

false

22

Slide image

23

Multiple Choice

Which gets to be evaluated first in the expression below?


(true || false) && (!true || !false)

1

true

2

false

3

!true

4

!false

5

(true || false)

24

Multiple Choice

If the value of count is 0 and the value of limit is 10, evaluate if the expression below returns true or false.


(count == 0) && (limit < 20)

1

true

2

false

25

Multiple Choice

If the value of count is 0 and the value of limit is 10, evaluate if the expression below returns true or false.


count == 0 && limit < 20

1

true

2

false

26

Multiple Choice

If the value of count is 0 and the value of limit is 10, evaluate if the expression below returns true or false.


(limit > 20) || (count < 5)

1

true

2

false

27

Multiple Choice

If the value of count is 0 and the value of limit is 10, evaluate if the expression below returns true or false.


!(count == 12)

1

true

2

false

28

Slide image

29

Slide image

30

Slide image

31

Multiple Select

Which of the following is/are true about IF statements? Check all that applies.

1

The only way for the body of IF statement to execute is for the condition to be TRUE.

2

It repeats the block of code

3

The body is executed first before testing the condition.

4

The condition is always tested before executing the body.

5

It executes a statement or a block of statement depending on some condition(s).

32

Slide image

33

Slide image

34

Multiple Choice

What is the value of x after performing the code block below?



 int x = 0;int\ x\ =\ 0;  


 if(x>1) x = x + 1;if\left(x>1\right)\ x\ =\ x\ +\ 1; 

  x = x + 2;x\ =\ x\ +\ 2;  

1

0

2

1

3

2

4

3

35

Slide image

36

Slide image

37

Slide image

38

Slide image

39

Slide image

40

Multiple Choice

Which is true about if-else statements?

1

Both the body of If and Else will be performed regardless of the result if the condition.

2

Only the body of the If statement is performed if the condition is true.

3

Only the body of the else statement is performed if the condition is true.

4

The else statement requires a condition for its body to execute.

41

Slide image

42

Slide image

43

Slide image

44

Slide image

45

Slide image

46

Slide image

47

Multiple Choice

Question image

if x is 3, what is the output of the code snippet below?

1

test

2

run

3

test run

4

No output

48

Multiple Choice

Question image

What is the output of the code snippet below if x is 3?

1

test

2

run

3

test run

4

no output

49

Slide image

50

Slide image

51

Slide image

52

Slide image

53

Slide image

54

Slide image

55

Slide image

56

Slide image

57

Slide image

58

Multiple Choice

Question image

What is the value of y if x =3?

1

1

2

2

3

3

4

4

59

Slide image

60

Slide image

61

Slide image

62

Slide image

63

Slide image

64

Slide image

65

Slide image

66

Slide image

67

Slide image

68

Slide image

69

Multiple Choice

Question image

If x is 2, what is the output of the code snippet?

1

is

2

a break

3

is a break

4

is a break indeed.

5

This is a break

70

Multiple Choice

Question image

If x is 2, what is the output of the code snippet?

1

is

2

a break

3

is a break

4

is a break indeed.

5

This is a break

CSDC101 - Control Structures 1

Sequence | Selection | Repetition

Slide image

Show answer

Auto Play

Slide 1 / 70

SLIDE