Question
1. The result of the following statement is __. >>> if (True) : print((9 != 7)) ... A. 1 B. 0 C. True D. False
1. The result of the following statement is __. >>> if (True) : print((9 != 7)) ... A. 1 B. 0 C. True D. False 2. The result of the following statement is __. >>> 1 if True else 0 A. 1 B. 0 C. True D. False 3. The result of the following script is __. i=6; if (i>=4): if (i==5): print(i); else: print(i-1); else: print(i+1); A. 4 B. 5 C. 6 D. 3 4. The result of the following script is __. i=3; if (i>=4): if (i==5): print(i); else: print(i-1); else: print(i+1); A. 4 B. 5 C. 6
D. 3 5. The result of the following script is __. s = "" x = 5 if (x == 5) : s = s + str(5) if (x >= 4) : s = s + str(4) if (x < 4) : s = s + str(3) if (x <= 3) : s = s + str(2) print(s) A. 5 B. 54 C. 543 D. 5432 6. The result of the following script is __. x = 4 if (x > 4) : if (x < 3) : if(x > 1) : print(x) else : print(x-1) else: print(x-2) else: print(x-3) A. 4 B. 3 C. 2 D. 1 7. The result of the following script is __. x = 4 if (x >= 4) : print(x) elif (x < 3) : print(x-1) elif(x > 1) : print(x-2) else: print(x-3) A. 4 B. 3 C. 2 D. 1 8. The result of the following script is __. x = 25 if x in range(24, 25): print("apple") if x in range(25, 26): print("banana")
else: print("cherry") else: print("dragonfruit") A. apple B. banana C. cherry D. dragonfruit 9. The result of the following script is __. x = 45 x = x % 3 if (x == 1) : print(1) elif (x == 2) : print(2) elif (x == 3) : print(3) else : print(0) A. 0 B. 1 C. 2 D. 3 10. The result of the following script is __. x = 25 switch = { 0: "apple", 1: "banana", 2: "cherry", 3: "dragonfruit" } print(switch[x % 3]) A. apple B. banana C. cherry D. dragonfruit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started