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

Exam PCAP All Questions

View all questions & answers for the PCAP exam

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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ivanbicalho
Highly Voted 1 year, 9 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 2 years, 6 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 10 months 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
1 year, 3 months ago
Selected Answer: AD
After executing the snippet: a = a[0] = 0 b = b[0] = 1
upvoted 1 times
...
Amcal
1 year, 8 months ago
A and C are correct
upvoted 1 times
...
greyhats13
1 year, 11 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, 12 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
2 years, 2 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
2 years, 3 months ago
Correct Answer is A C
upvoted 2 times
...
besha
2 years, 4 months ago
Selected Answer: AC
Correct answer is A C
upvoted 1 times
...
Baldridge
2 years, 6 months ago
Selected Answer: AC
A C are correct
upvoted 1 times
...
666_m
2 years, 6 months ago
A & C is correct.
upvoted 3 times
...
macxsz
2 years, 7 months ago
a and b are the same list A. len(a) == len (b) C. a [0] == b [0]
upvoted 4 times
...
yuv322
2 years, 7 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 ...