Question: Greeting! Kindly help me to solve my finals in PYTHON, I don't have a knowledge in PYTHON, new student. Please, please, I'm begging, Kindly answers
Greeting! Kindly help me to solve my finals in PYTHON, I don't have a knowledge in PYTHON, new student.
Please, please, I'm begging, Kindly answers all the questions. I'm hoping to grant my request.
Thanks in advanced.
1.) What is the output of the following snippet?
l1 = [1,2] for v in range(2): l1.insert(-1,l1[v]) print(l1)
a.) [1, 2, 2, 2] b.) [1, 1, 1, 2] c.) [1, 2, 1, 2] d.) [1, 1, 1, 2]
2.) The meaning of a positional argument is determined by:
a.) its position within the argument list b.) its value c.) its connection with existing variables d.) the arguments name specified along with its value
3.) Which of the following sentences are true? Choose all that apply.
nums = [1,2,3] vals = nums
a.) nums and vals are different lists b.) vals is longer than nums c.) nums and vals are different names of the same list d.) nums is longer than vals
4.) An operator able to check whether two values are not equal is coded as:
a.) <> b.) != c.) =/= d.) not ==
5.) The following snippet:
def func1(a): return None def func2(a): return func1(a)*func1(a) print(func2(2))
a.) will output 4 b.) will output 2 c.) will cause a runtime error d.) will output 16
6.) The result of the following division:
1 // 2
a.) is equal to 0.0 b.) cannot be predicted c.) is equal to 0.5 d.) is equal to 0
7.) The following snippet:
def func(a,b): return b ** a print(func(b=2,2))
a.) will output 2 b.) is erroneous c.) will return None d.) will output 4
8.) What value will be assigned to the x variable?
z = 0 y = 10 x = y < z and z > y or y > z and z < y
a.) 1 b.) False c.) True d.) 0
9.) One of the following variables names is illegal which one?
a.) in_ b.) in c.) In d.) IN
10.) What is the output of the following snippet?
list = [x*x for x in range(5)] def fun(L): del L[L[2]] return L print(fun(list))
a.) [0, 1, 4, 16] b.) [0, 1, 4, 9] c.) [1, 4, 9, 16] d.) [0, 1, 4, 16]
11.) What is the output of the following piece of code?
x=1 y=2 x, y, z = x, x, y z, y, z = x, y, z print(x,y,z)
a.) 2 1 2 b.) 1 2 1 c.) 1 1 2 d.) 1 2 2
12.) What will the output of the following snippet?
a = 1 b = 0 a = a ^ b b = a ^ b a = a ^ b print(a,b)
a.) 0 1 b.) 0 0 c.) 1 1 d.) 1 0
13.) What is the output of the following snippet?
def fun(x): if x % 2 == 0: return 1 else: return 2 print(fun(fun(2)))
a.) the code will cause a runtime error b.) 1 c.) 2 d.) None
14.) Take a look at the snippet and choose the true statement:
nums = [1,2,3] vals = nums del vals[:]
a.) vals is longer than nums b.) the snippet will cause a runtime error c.) nums and vals are different names of the same list d.) nums and vals are different lists
15.) What is the output of the following piece of code if the user enters two lines containing 3 and 2 respectively?
x=int(input()) y=int(input()) x = x % y x = x % y y = y % x print(y)
a.) 0 b.) 2 c.) 3 d.) 1
16.) What is the output of the following piece of code if the user enters two lines containing 3 and 6 respectively?
y=input() x=input() print(x+y)
a.) 36 b.) 3 c.) 63 d.) 6
17.) What is the output of the following piece of code?
print("a","b","c",sep="sep")
a.) asepbsepc b.) asepbsepcsep c.) abc d.) a b c
18.)What is the output of the following piece of code?
X = 1 // 5 + 1 / 5 print(X)
a.) 0.2 b.) 0.0 c.) 0.4 d.) 0
19.) Assuming that the tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction:
tuple[1] = tuple[1] + tuple[0]
a.) can be executed if and only if the tuple contains at least two elements b.) is fully correct c.) is illegal d.) may be illegal if the tuple contains strings
20.) What is the output of the following piece of code if the user enters two lines containing 2 and 4 respectively?
x=float(input()) y=float(input()) print(y ** (1/x))
a.) 1.0 b.) 4.0 c.) 0.0 d.) 2.0
21.) What is the output of the following snippet?
dct = { 'one':'two', 'three':'one', 'two':'three' } v = dct['three'] for k in range(len(dct)): v = dct[v] print(v)
a.) two b.) three c.) one d.) ('one', 'two', 'three')
22.) How many elements does the L list contain?
L = [i for i in range(-1,-2)]
a.) 2 b.) 3 c.) 1 d.) 0
23.)Which of the following lines improperly invokes the function defined as:
def fun(a,b,c=0) Choose all that apply.
a.) fun(b=1): b.) fun(a=1,b=0,c=0): c.) fun(0,1,2): d.) fun(a=0,b=0):
24.) What is the output of the following snippet?
def fun(x,y): if x == y: return x else: return fun(x,y-1) print(fun(0,3))
a.) 1 b.) the snippet will cause a runtime error c.) 2 d.) 0
25.) How many stars will the following snippet send to the console?
i = 0 while i < i + 2 : i += 1 print("*") else: print("*")
a.) zero b.) the snippet will enter an infinite loop c.) two d.) one
26.) What is the output of the following snippet?
tup = (1, 2, 4, 8) tup = tup[-2:-1] tup = tup[-1] print(tup)
a.) (4,) b.) 44 c.) (4) d.) 4
27.) What is the output of the following snippet?
dd = { "1":"0", "0":"1" } for x in dd.vals(): print(x,end="")
a.) 0 0 b.) 1 0 c.) the code is erroneous d.) 0 1
28.) What is the output of the following snippet?
dct = {} dct['1'] = (1,2) dct['2'] = (2,1) for x in dct.keys(): print(dct[x][1],end="")
a.) 12 b.) 21 c.) (1,2) d.) (2,1)
29.) What is the output of the following snippet?
def fun(inp=2,out=3): return inp * out print(fun(out=2))
a.) 6 b.) 2 c.) the snippet is erroneous d.) 4
30.) How many hashes will the following snippet send to the console?
lst = [[x for x in range(3)] for y in range(3)] for r in range(3): for c in range(3): if lst[r][c] % 2 != 0: print("#")
a.) six b.) zero c.) nine d.) three
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
