Exam PCAP All QuestionsBrowse all questions from this exam
Question 12

Assuming that the following snippet has been successfully executed, which of the equations are False? (Choose two.)

    Correct Answer: C, D

    AB

Discussion
FarukhJamalOptions: CD

In question, he asked for False equations. so Ans: C and D. because A and B are True

macxszOptions: CD

these two are false: C. a [0]== b [0] D. b [0] - 1 ==a [0]

rodanielbOptions: CD

After executing the snippet: a = a[0] = 1 b = b[0] = 0

ivanbicalhoOptions: CD

AB is true, but the question asks for the False ones, so: CD When you have an array in a variable and set it to another variable, they share the same id: a = [1] b = a print(id(a), id(b)) #same id BUT, unlike the previous question, when you do this: a = [1] b = a[:] # [start:stop:step] b has now a different id, that means it is a different array

diazedOptions: CD

C & D are the correct answers

xsaintsOptions: AB

why are answers given incorrect? was asking for false, instead trues were given (?)

Ello2023

Lists [] are always mutable Tuples () are always immutable Therefore a and b will not stay the same as they are both lists compared to the previous question.

AmcalOptions: CD

C and D

MherSimonyanOptions: CD

Correct Answer should be C and D as the question says which equations are False a = [0] b = a[:] a[0] = 1 a[0] # is 1 b[0] # is 0 so: print(len(a) == len(b)) # => True print(a[0] - 1 == b[0]) # => True print(a[0] == b[0]) # => False print(b[0] - 1 == a[0]) # => False

naveenbv80Options: CD

a=[0] b=a[:] a[0]=1 print(len(a) == len(b)) --> True print(a[0] - 1 == b[0]) --> True print(a[0] == b[0]) --> False print(b[0] - 1 == a[0]) --> False My answer is C and D

JnanadaOptions: CD

Correct Answer should be C and D as the question says which equations are False

PremJaguarOptions: CD

These answers are wrong, c and d are right

japimilOptions: CD

ask about false ones

AlMargoiOptions: CD

Should be C, D.

rocky48Options: CD

>>> len(a)==len(b) True >>> a [0]-1 ==b[0] True >>> a [0]== b [0] False >>> b [0] - 1 ==a [0] False

KuzymirOptions: CD

False are C & D

GioGiuntaOptions: CD

answer should be C and D, it's asking for False not True