Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following code Which of the following is an equivalent program? (See D

ID: 3872565 • Letter: G

Question

Given the following code

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

x = 5
y = 5

x = 5
y = 5

x = 5
y = 5

x = 5
y = 5

What would be printed if the following python code was executed

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

What would be printed if the following instructions were executed?

      X = 4

      while (X > 0):

      print(X-1)

          X = X – 1

a.    32 1                      b. 4 32 1             c. 3 21 0             d. None of these

Answer: d. None of these

If the sum of the degrees of all vertices in a graph is 20 then the number of edges the graph will have is :

a. 10              b. 40                     c 30                       d. None of these

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

6.Graph Theory document Question #1 (minimum number of edges that need to be added to have an Euler path)

1

2

3

4

x = 5
y = 5

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

x = 5
y = 5

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

x = 5
y = 5

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

x = 5
y = 5

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

Explanation / Answer

Answer 1: option 2:

x = 5
y = 5

Explanation: On applying Demorgan law

not ((x >5) or (y >5)) = not (x >5) and not(y>5)

Answer 2: None of these

Explanation: The value of x will always remain greater than x, since the decrement x=x-1 lies outside the while loop.

Here, you need to note that in Python, indentation defines the scope of variables. Thus this program will end in an infinite loop.

Answer 3: d: None of these.

Explanation: This will give indentation error. Since print(X-1) is not lying in while loop block.

Answer 4: a.10

This comes from sum of degrees of vertices theorem. It says that the sum of the degrees of vertices in a graph is always equal to twice the no of edges.

Answer 5: d. None of the code correctly determines if you need to write a paper or not.

Here, The condition says that, one should score 90 or above in both the tests. Score 90 or above means it can be either equal to 90 or greater than 90, i.e test1>=90 test2>=90. And “In both the test signifies” and of two operations i.e, (test1>=90)and (test2>=90).

Answer 6: need a graph to answer this question. Please complete the question.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote