Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Warm Greeting Hello M New Student Kindly Help Solve Final Exam Python Please Please M Begg Q35532415

Warm Greeting!

Hello, there,
I’m a new student. Kindly help me to solve my final exam inPYTHON.

Please, please, I’m begging, Kindly answers all thequestions. it’s really biggest help for me to grant myrequest.
Thanks in advanced.

1.) The meaning of the keyword argument is determined by:

   a.) the argument’s name specified along with itsvalue
   b.) its value
   c.) its connection with existing variables
   d.) its position within the argument list

2.) Which of the following sentences is true?

str1 = ‘string’
str2 = str1[:]

   a.) “>str1 and str2 are different names of thesame string
   b.) str1 and str2 are different (but equal)strings
   c.) str2 is longer than str1
   d.) str1 is longer than str2

3.) An operator able to check whether two values are equal, iscoded as:

   a.) ==
   b.) is
   c.) ===
   d.) =

4.) The following snippet:

def f(par2,par1):
return par2 + par1
print(f(par2=1,2))

   a.) will output 1
   b.) is erroneous
   c.) will output 2
   d.) will output 3

5.) What value will be assigned to the x variable?

z = 2
y = 1
x = y < z or z > y and y > z or z < y

   a.) True
   b.) 1
   c.) False
   d.) 0

6.) What will be the output of the following snippet?

str = ‘abcdef’
def fun(s):
del s[2]
return s
print(fun(str))

   a.) abcef
   b.) the program will cause an error
   c.) acdef
   d.) abdef

7.) What will be the output of the following piece of code?

x, y, z = 3, 2, 1
z, y, x = x, y, z
print(x,y,z)

       a.) 1 2 2
       b.) 3 2 1
       c.) 2 1 3
       d.) 1 2 3

8.) What will be the output of the following snippet?

a = True
b = False
a = a or b
b = a and b
a = a or b
print(a,b)

   a.) True True
   b.) True False
   c.) False False
   d.) False True

9.) What will be the output of the following snippet?

def fun(x):
return 1 if x % 2 != 0 else 2
print(fun(fun(1)))

       a.) None
       b.) 2
       c.) the code will cause a runtimeerror
       d.) 1

10.) What will be the output of the following line?

print(len((1,)))

       a.) 2
       b.) the code is erroneous
       c.) 1
       d.) 0

11.) What will be the output of the following piece of code?

d = { 1:0, 2:1, 3:2, 0:1 }
x = 0
for y in range(len(d)):
x = d[x]
print(x)

       a.) the code will cause aruntime error
       b.) 2
       c.) 0
       d.) 1

12.) What will be the output of the following piece of code:

y=input()
x=input()
print(x+y)

if the user enters two lines containing 1 and 2respectively?

       a.) 12
       b.) 21
       c.) 2
       d.) 3

13.) What will be the output of the following piece of code?

print(“a”,”b”,”c”,sep=”‘”)

       a.) a’b’c
       b.) abc
       c.) a b c
       d.) the code is erroneous

14.) What will be the output of the following piece of code?

v = 1 + 1 // 2 + 1 / 2 + 2
print(v)

       a.) 3.5
       b.) 4.0
       c.) 3
       d.) 4

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

t = (1,)
t = t[0] + t[0]
print(t)

       a.) 1
       b.) (1,)
       c.) 2
       d.) (1, 1)

16.) What will be the output of the following piece of code?

x = 16
while x > 0:
print(‘*’,end=”)
x //= 2
   ***

17.) What will be the output of the following snippet?

d = { ‘one’:1, ‘three’:3, ‘two’:2 }
for k in sorted(d.values()):
print(k,end=’ ‘)

       a.) 3 2 1
       b.) 1 2 3
       c.) 2 3 1
       d.) 3 2 1

18.) What will be the output of the following snippet?

print(len([i for i in range(0,-2)]))

       a.) 0
       b.0 2
       c.) 1
       d.) 3

19.) Which of the following lines properly invokes the functiondefined as:
def fun(a,b,c=0)?

       a.) fun(0):
       b.) fun(1,c=2):
       c.) fun(b=0,b=0):
       d.) fun(a=1,b=0,c=0):

20.) What will be the output of the following snippet?

l = [1,2,3,4]
l = list(map(lambda x: 2*x,l))
print(l)

       a.) the snippet will cause aruntime error
       b.) 10
       c.) 2 4 6 8
       d.) 1 2 3 4

21.) How many stars will the following snippet send to theconsole?

i = 4
while i > 0 :
i -= 2
print(“*”)
if i == 2:
break
else:
print(“*”)

       a.) 0
       b.) 1
       c.) 2
       d.) the snippet will enter aninfinite loop

22.) What will be the output of the following snippet?

t = (1, 2, 3, 4)
t = t[-2:-1]
t = t[-1]
print(t)

       a.) 3
       b.) 33
       c.) (3)
       d.) (3,)

23.) What will be the output of the following snippet?

d = {}
d[‘2’] = [1,2]
d[‘1’] = [3,4]
for x in d.keys():
print(d[x][1],end=””)

       a.) 13
       b.) 24
       c.) 31
       d.) 42

24.) What will be the output of the following snippet?

def fun(d,k,v):
d[k]=v
dc = {}
print(fun(dc,’1′,’v’))

       a.) the snippet iserroneous
       b.) None
       c.) 1
       d.) v

25.) How many empty lines will the following snippet send to theconsole?

l = [[c for c in range(r)] for r in range(3)]
for x in l:
if len(x) < 2:
print()

       a.) 2
       b.) 1
       c.) 3
       d.) 0

26.) Knowing that the function named m() resides in the modulenamed f, and the code contains the following import statement,choose the right way to invoke the function:

from m import f

       a.) mod.fun()
       b.) mod:fun()
       c.) fun()
       d.) the import statement isinvalid

27.) The package directory/folder may contain a file intended toinitialize the package. Its name is:

       a.) init.py
       b.) __init.py__
       c.) __init__.py
       d.) __init__.

28.) The folder created by Python used to store pyc files isnamed:

       a.) __pycfiles__
       b.) __pyc__
       c.) __pycache__
       d.) __cache__

29.) What will be the output of the following code, located in thefile module.py?

print(__name__)

       a.) module.py
       b.) __module.py__
       c.) __main__
       d.) main

30.) If you want to tell your module’s users that a particularvariable should not be accessed directly, you may:

       a.) start its name with acapital letter
       b.) start its name with _ or__
       c.) use its number instead of itsname
       d.) build its name with lowercaseletters only

Leave a Reply

Your email address will not be published. Required fields are marked *