6. What is printed by the following when executes? 1 str "His shirt is red" 2 pos= str.find("is") 3 print (pos) A. 9 B. 2 C. pos D. 1 7. What is the value of s1 after the following code executes? 1 s1= "heY" 2 s1 s1.capitalize() ss1.lower () A. heY B. Hey C. hey D. HEY 8. Which line of code correctly gets the value of the key 'apples' if it exists and returns 0 if it does not? 1 fruits = {'bananas': 7, 'apples': 4, 'grapes': 19, 'pears': 4) A. fruits.get(apples) B. fruits.get(apples,0) C. fruits.get('apple') D. fruits.get('apples',0) 9. What is printed by the following statements? 1 s = "ball" THH for item in s: r= item.upper () + r print (r) A. Ball B. BALL C. LLAB D. TypeError 10. Which type of loop can be used to perform the following iteration: You choose a positive integer at random and then print the numbers from 1 up to and including the selected integer.. A. Only FOR-loop B. Only WHILE-loop C. FOR and/or WHILE loops D. NONE 11. What will the following code print? 1 for i in range (1,4): 2 for j in range (1,4): print (i, j, end-¹ A. 112233 B. 123123123 C. 112131212223313233 D. 111213212223313233 notion? 2 3 4
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.
please solve question 10 python
![6. What is printed by the following when executes?
1
str "His shirt is red".
2
pos= str.find("is")
3 print (pos)
A. 9 B. 2 C. pos D. 1
7. What is the value of s1 after the following code executes?
1
s1= "heY"
2 s1 s1.capitalize()
ss1.lower ()
A. heY B. Hey
C. hey D. HEY
8. Which line of code correctly gets the value of the key 'apples' if it exists and returns 0 if it does not?
1
fruits = {'bananas': 7, 'apples': 4, 'grapes': 19, 'pears': 4)
A. fruits.get(apples) B. fruits.get(apples,0) C. fruits.get('apple') D. fruits.get('apples',0)
9. What is printed by the following statements?
1
s = "ball"
T=HH
for item in s:
r= item.upper () + r
print (r)
A. Ball B. BALL
C. LLAB D. TypeError
10. Which type of loop can be used to perform the following iteration: You choose a positive integer at
random and then print the numbers from 1 up to and including the selected integer.
A. Only FOR-loop B. Only WHILE-loop C. FOR and/or WHILE loops D. NONE
11. What will the following code print?
1
for i in range (1,4):
2
for j in range (1,4):
print (i, j, end=> >)
A. 112233
B. 123123123
C. 112131212223313233
D. 111213212223313233
12. What is returned by the following function?
def list within_list():
2
alist = [3, 67, "cat", [56, 57, "dog"], [], 3.14, False]
return alist [2] [0]
A. c B. 56
C. cat D. Error
2
3
4
5](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0fc07b1a-b018-46dc-8562-30e8b2260ec4%2Fe92c45b9-f185-4641-b776-bc8d2c9b5073%2F3grnpfu_processed.jpeg&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









