Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam PCAP topic 1 question 11 discussion

Actual exam question from Python Institute's PCAP
Question #: 11
Topic #: 1
[All PCAP Questions]

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

  • A. len(a) == len (b)
  • B. b [0] +1 ==a [0]
  • C. a [0] == b [0]
  • D. a [0] + 1 ==b [0]
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ivanbicalho
Highly Voted 1 year, 2 months ago
Selected Answer: AC
For you who thought it was AD, here is the explanation: When you have an array in a variable and set it to another variable, they share the same id, that means they point to the same array. a = [1] b = a print(id(a), id(b)) # same id Since a==b, when you set a[0] = 0, you are "also" doing b[0] = 0
upvoted 11 times
...
rbishun
Highly Voted 1 year, 11 months ago
A and C are correct. a = [1] b = a a[0] = 0 print(len(a) == len(b)) # True print(a[0] == b[0]) # True
upvoted 6 times
...
seaverick
Most Recent 2 months, 3 weeks ago
Selected Answer: AC
a=[1] b=a a[0]=0 print(len(a)==len(b))#True print(b[0]+1 == a[0])#False print(a[0] == b[0])#True print(a[0]+1 == b[0])#False Ans is A,C
upvoted 1 times
...
rodanielb
8 months, 2 weeks ago
Selected Answer: AD
After executing the snippet: a = a[0] = 0 b = b[0] = 1
upvoted 1 times
...
Amcal
1 year, 1 month ago
A and C are correct
upvoted 1 times
...
greyhats13
1 year, 3 months ago
Selected Answer: AC
if you print(b[0]) it will print 0, so the answer is A and C.
upvoted 1 times
...
naveenbv80
1 year, 4 months ago
a=[1] b=a a[0]=0 print(len(a) == len(b)) -> True print(a[0] == b[0]) --> True print(b[0] + 1 == a[0]) --> False print(a[0] + 1 == b[0]) --> False My answer is A and C
upvoted 1 times
...
JO5H
1 year, 6 months ago
Selected Answer: AC
The Answer is suprisingly A & C, i thought it was A & D until i tried it
upvoted 3 times
...
Jnanada
1 year, 8 months ago
Correct Answer is A C
upvoted 2 times
...
besha
1 year, 9 months ago
Selected Answer: AC
Correct answer is A C
upvoted 1 times
...
Baldridge
1 year, 10 months ago
Selected Answer: AC
A C are correct
upvoted 1 times
...
666_m
1 year, 11 months ago
A & C is correct.
upvoted 3 times
...
macxsz
1 year, 11 months ago
a and b are the same list A. len(a) == len (b) C. a [0] == b [0]
upvoted 4 times
...
yuv322
1 year, 11 months ago
Selected Answer: AD
A & D Are the correct answers.
upvoted 2 times
...
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.

SaveCancel
Loading ...