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.
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
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
This section is not available anymore. Please use the main Exam Page.PCAP Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
FarukhJamal
Highly Voted 3 years, 6 months agoAmirhoseinShojaei
Most Recent 2 weeks, 1 day agorodanielb
1 year, 8 months agoEllo2023
1 year, 11 months agoAmcal
2 years, 1 month agoivanbicalho
2 years, 1 month agoMherSimonyan
2 years, 2 months agonaveenbv80
2 years, 4 months agoJnanada
2 years, 8 months agoPremJaguar
2 years, 9 months agomacxsz
2 years, 11 months agojapimil
2 years, 12 months agoAlMargoi
3 years agorocky48
3 years, 1 month agoKuzymir
3 years, 1 month agoGioGiunta
3 years, 2 months agodiazed
3 years, 3 months ago