File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ *******************************
2
+ WEEK-3 QUIZ: Switch Questions
3
+ *******************************
4
+
5
+
6
+ --------------------------------------------------------------------------------------------------------------------------------------------------------
7
+ . . .
8
+ switch(i)
9
+ {
10
+
11
+ case 1: printf(“case 1 \n”); break;
12
+ case 2: printf(“case 2 \n”);
13
+ case 3: printf(“case 3 \n”);break;
14
+
15
+ default: printf(“default case \n”);
16
+
17
+ };
18
+
19
+
20
+ >>
21
+
22
+ 1. If i starts off as 1 then printf will print:
23
+
24
+ I - case 1 <---------------------- [ANSWER]
25
+ II - case 1 case 2
26
+ III - will not print
27
+ IV - default case
28
+
29
+ --------------------------------------------------------------------------------------------------------------------------------------------------------
30
+ 2. If i starts out as 15 the printf will print:
31
+
32
+ I - case 15
33
+ II - case 1
34
+ III - will not print
35
+ IV - default case <---------------------- [ANSWER]
36
+
37
+ --------------------------------------------------------------------------------------------------------------------------------------------------------
38
+ 3. If i starts out as 2 the printf will print:
39
+
40
+ I - case 2
41
+ II - case 2 case 3 <---------------------- [ANSWER]
42
+ III - will not print
43
+ IV - default case
44
+
45
+ --------------------------------------------------------------------------------------------------------------------------------------------------------
46
+
47
+
48
+
49
+ ~ TSG405, 2021
You can’t perform that action at this time.
0 commit comments