Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(+5) What sequence of values will be printed when the following instructions are executed? X = 1 if (X < 7): print(6) Y = 6

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

X = 1 if (X < 7): print(6) Y = 6 elif (X < 4): print(4) Y = 4 elif (X < 2): print(Y) else: print(2)

a. 6 b. 2 c. 4 d. None of these

(+5) What would be printed if the following instructions were executed?

X = 4 while (X > 0): print(X % 2) X = X - 1

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

(+5) What would be printed if the following function were executed

X = 2 Y = 7 while (X < Y): print(X) X = X + 1 Y = Y 1

a. 2 3 4 b. 3 4 5 c 2 3 4 5 d. None of these

(+5) If the sum of the degrees of all vertices in a graph is 30 then the number of edges the graph will have is :

a. 15 b. 60 c 30 d. None of these

(+5) A school has decided to give students cash prize if they achieve a good GPA. If GPA is higher than 3.5, the student will get $100. If GPA is higher than 3.0 but does not exceed 3.5, the student will get $50. No cash prize is awarded if GPA is 3.0 or below. Which of the following Python statements implements this cash prize system?

A.

if gpa > 3.5:

prize = 100

elif gpa > 3.0 and gpa < 3.5:

prize = 50

else:

prize = 0

B.

if gpa > 3.5:

prize = 100

elif gpa > 3.0 or gpa < 3.5:

prize = 50

else:

prize = 0

C.

if gpa >= 3.5:

prize = 100

elif gpa > 3.0 and gpa < 3.5:

prize = 50

else:

prize = 0

D.

if gpa > 3.5:

prize = 100

elif gpa > 3.0 and gpa <= 3.5:

prize = 50

else:

prize = 0

(+5) Students are required to take two tests and write a review paper in a course. However, students who score 90 or above in both tests do not have to write the review paper. Which of the following python statements correctly determines whether a student needs to write a paper?

A.

if test1 < 90 and test2 < 90:

print('you need to write the review paper')

else:

print('you do not need to write the review paper')

B.

if test1 >= 90 or test2 >= 90:

print('you do not need to write the review paper')

else:

print('you need to write the review paper')

C.

if test1 < 90 or test2 < 90:

print('you need to write the review paper')

else:

print('you do not need to write the review paper')

D.

None of the code above correctly determines if you need to write a paper

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Iv Special Issue On Database Systems For Biomedical Applications Lncs 6990

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Christian Bohm ,Johann Eder ,Claudia Plant

2011th Edition

3642237398, 978-3642237393

More Books

Students also viewed these Databases questions