b)1.a=1 2.whileTrue: 3.ifa%7==0: 4.break 5.print(a)6.a+=1 Which of the following is correct output of this program? A.1 2 3 4 5 B.1 2 3 4 5 6 C.1 2 3 4 5 6 7 D.Invalid syntax
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
b)1.a=1
2.whileTrue:
3.ifa%7==0:
4.break
5.print(a)6.a+=1
Which of the following is correct output of this program?
A.1 2 3 4 5
B.1 2 3 4 5 6
C.1 2 3 4 5 6 7
D.Invalid syntax
c)1.i=0
2.whilei<3:
3.print(i)
4.i+=1
5.else:
6.print(0)
What will be the output of this statement?
A.0 1
B.0 1 2
C.0 1 2 0
D.0 1 2 3
d)1.i=0
2.whilei<5:
3.print(i)
4.i+=1
5.ifi==3:
6.break
What will be the output of this statement?
A.1 2 3
B.0 1 2 3
C.0 1 2
D.3 2 1
e)1.d={0:'a',1:'b',2:'c'}
2.foriind:
3.print(i)
What will be the output of this statement?
A.a b c
B.0 1 2
C.0 a 1 b 2 c
D.None of these above
(i need only answer)
Step by step
Solved in 2 steps