Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given two positive numbers A and B. You need to find the maximum valued integer X such that: X divides A i.e. A

You are given two positive numbers A and B. You need to find the maximum valued integer X such that:

X divides A i.e. A % X = 0

X and B are co-prime i.e. gcd(X, B) = 1

For example,

A = 30

B = 12

We return

X = 5

Please doanswer all the questions with proper explanation, I need code for above cp question and it should pass all large and corner test cases, I need explanation for each mcq below. Please don't copy

1. What will be the output of the following Python code?

import turtle

t=turtle.Pen()

for i in range(0,5):

t.left(144)

t.forward(100)

a) Trapezium

b) Parallelepiped

c) Tetrahedron

d) Star

2. What will be the output of the following Python code?

x = [12, 34]

print(len(' '.join(list(map(int, x)))))

a) 4

b) 5

c) 6

d) error

3. What will be the output of the following Python code?

a={}

a[2]=1

a[1]=[2,3,4]

print(a[1][1])

a) [2,3,4]

b) 3

c) 2

d) An exception is thrown

4. What will be the output of the following Python code?

def foo():

total += 1

return total

total = 0

print(foo())

a) 0

b) 1

c) error

d) none of the mentioned

5. What will be the output of the following Python code?

random.seed(3)

random.randint(1,5)

2

random.seed(3)

random.randint(1,5)

a) 3

b) 2

c) Any integer between 1 and 5, including 1 and 5

d) Any integer between 1 and 5, excluding 1 and 5

6. What will be the output of the following Python code?

odd=lambda x: bool(x%2)

numbers=[n for n in range(10)]

print(numbers)

n=list()

for i in numbers:

if odd(i):

continue

else:

break

a) [0, 2, 4, 6, 8, 10]

b) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

c) [1, 3, 5, 7, 9]

d) Error

7. What is the pickling?

a) It is used for object serialization

b) It is used for object deserialization

c) None of the mentioned

d) All of the mentioned

8. What will be the output of the following Python code?

a=10

globals()['a']=25

print(a)

a) 10

b) 25

c) Junk value

d) Error

9. How many except statements can a try-except block have?

a) zero

b) one

c) more than one

d) more than zero

10. What will be the output of the following Python code?

def cube(x):

return x * x * x

x = cube(3)

print x

a) 9

b) 3

c) 27

d) 30

11. What will be the output of the following Python code?

class A:

def init(self):

self.__x = 1

class B(A):

def display(self):

print(self.__x)

def main():

obj = B()

obj.display()

main()

a) 1

b) 0

c) Error, invalid syntax for object declaration

d) Error, private class member can't be accessed in a subclass

12. What will be the output of the following Python code?

def change(i = 1, j = 2):

i = i + j

j = j + 1

print(i, j)

change(j = 1, i = 2)

a) An exception is thrown because of conflicting values

b) 1 2

c) 3 3

d) 3 2

13. What will be the output of the following Python code?

re.escape('new**world')

a) 'new world'

b) 'new\\*\\*world'

c) '**'

d) 'new', '*', '*', 'world'

14. Which of the following functions does not necessarily accept only iterables as arguments?

a) enumerate()

b) all()

c) chr()

d) max()

15. What will be the output of the following Python code?

l=[-2, 4]

m=map(lambda x:x*2, l)

print(m)

a) [-4, 16]

b) Address of m

c) Error

d)

-4

16

16. What will be the output of the following Python code?

def C2F(c):

return c * 9/5 + 32

print C2F(100)

print C2F(0)

a)

212

32

b)

314

24

c)

567

98

d) None of the mentioned

17. Which of the following returns a string that represents the present working directory?

a) os.getcwd()

b) os.cwd()

c) os.getpwd()

d) os.pwd()

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_2

Step: 3

blur-text-image_3

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

how long is a teaching license good for in Las Vegas

Answered: 1 week ago

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago