Question: (+5) What would be printed if the following python code was executed X = 4 C = 0 while (X > 0): if (X %

(+5) What would be printed if the following python code was executed

X = 4 C = 0 while (X > 0): if (X % 2 == 0): C = C + 1 else: C = C -1 X = X - 1 print(C)

a. 0 b. 1 c 2 d. None of these

(+5 ) Given the following code

x = 5 y = 5 if (x > 5) or (y > 5): print('A') else: print('Z')

Which of the following is an equivalent program? (See DeMorgan Laws document )

A

x = 5 y = 5

if not(x > 5) and not(y > 5): print('A') else: print('Z')

B

x = 5 y = 5

if not(x > 5) and not(y > 5): print('Z') else: print('A')

C

x = 5 y = 5

if not(x > 5) or not(y > 5): print('A') else: print('Z')

D

x = 5 y = 5

if (x > 5) and (y > 5): print('Z') else: print('A')

(+5) What sequence of values will be printed when the following instructions are executed?

X = 5 if (X < 7): print(6) Y = 6 else: print(4) Y = 4 if (Y < 5): print(3) else: print(X)

6 5 b. 6 2 c. 5 4 d. 6 4 e. None of these

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!