Question 1: True and False Answer True or False to the following statements a) The following while loop will be executed only once and just prints k= TRUE FALSE k=0 while k < 3: print ("k=", k) k+=1 b) The following code will print True. a = 6 b = 10 print(a > 5 and a <7 or b < 12 and b > 2) c) The following code will print "x >= 5" x=y=5 if x < 5: if y > 5: print("x < 5 and y > 5") else: print("x >= 5") d) Letters= ['A', 'B','C','D','E', 'a', 'b', 'c','d', 'e'] for i in range(1,10,2): print(Letters[i], end="") B Dace will be printed e) sum = 0 for k in range (1,4): sum += k The value of sum is 16 f) for n in range (5,0, -1): print("n= ", n))) The for loop will be executed 5 times. g) The output of the following code is True. List1= ["green", "blue", "red"] List2 = ["green", "black", "cyan"] print(List1 != List2) TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Question 1: True and False
Answer True or False to the following statements
a) The following while loop will be executed only once and just prints k = 0.
TRUE
FALSE
k=0
while k < 3:
print ("k=", k)
k+=1
b) The following code will print True.
a = 6
b = 10
print(a > 5 and a <7 or b < 12 and b > 2)
c) The following code will print "x >= 5"
x = y = 5
if x < 5:
if y > 5:
print("x < 5 and y > 5")
print("x >= 5")
d) Letters= ['A', 'B','C','D','E', 'a','b', 'c','d', 'e']
for i in range(1,10,2):
else:
print(Letters[i], end="")
ent/ Faculty of Science
BDace will be printed
e) sum = 0
for k in range (1,4):
sum + k
The value of sum is 16
f) for n in range (5,0, -1):
print("n= ", n)
The for loop will be executed 5 times.
g) The output of the following code is True.
List1= ["green", "blue", "red"]
List2 = ["green", "black", "cyan"]
print(List1!= List2)
TRUE
FALSE
TRUE FALSE
TRUE FALSE
TRUE FALSE
TRUE FALSE
TRUE FALSE
Transcribed Image Text:Question 1: True and False Answer True or False to the following statements a) The following while loop will be executed only once and just prints k = 0. TRUE FALSE k=0 while k < 3: print ("k=", k) k+=1 b) The following code will print True. a = 6 b = 10 print(a > 5 and a <7 or b < 12 and b > 2) c) The following code will print "x >= 5" x = y = 5 if x < 5: if y > 5: print("x < 5 and y > 5") print("x >= 5") d) Letters= ['A', 'B','C','D','E', 'a','b', 'c','d', 'e'] for i in range(1,10,2): else: print(Letters[i], end="") ent/ Faculty of Science BDace will be printed e) sum = 0 for k in range (1,4): sum + k The value of sum is 16 f) for n in range (5,0, -1): print("n= ", n) The for loop will be executed 5 times. g) The output of the following code is True. List1= ["green", "blue", "red"] List2 = ["green", "black", "cyan"] print(List1!= List2) TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY