exam questions

Exam JN0-220 All Questions

View all questions & answers for the JN0-220 exam

Exam JN0-220 topic 1 question 46 discussion

Actual exam question from Juniper's JN0-220
Question #: 46
Topic #: 1
[All JN0-220 Questions]

Click the Exhibit button.
What is the final output produced by the Python commands shown in the exhibit?

  • A. [5]
  • B. [5,4,6]
  • C. [5,2,4,6]
  • D. [2,4,6]
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
fakrulalam
3 years, 6 months ago
>>> a = list() >>> a.append(2) >>> a.append(4) >>> a.append(6) >>> b = a >>> a(0) = 5 File "<input>", line 1 a(0) = 5 ^ SyntaxError: cannot assign to function call >>> b [2, 4, 6]
upvoted 1 times
...
lxs
4 years, 3 months ago
a,b lists are objects. b = a is a reference to a object. IF you change a, b will be changed too. The correct answer is it will throw an error. you cannot use () for list item. You need to use a[0] instead.
upvoted 1 times
...
osmankh1
4 years, 8 months ago
a(0) = 5 will give an error because the list elements can either be added as a[0] = 5 or using functions. So it will remain 2,4,6
upvoted 1 times
...
pr0fectus
4 years, 10 months ago
This is a trick question. Remember that we can only work on lists by using the syntax "LIST_NAME[n]" where "n" is the position of the element. not LIST_NAME(n) as this syntax would return an error.
upvoted 1 times
...
mehmetcc
4 years, 10 months ago
a not static valid. D is correct...
upvoted 1 times
...
aviz
5 years, 3 months ago
D is correct. as a(0) = 5 gives a error.
upvoted 2 times
...
johnelvis
5 years, 3 months ago
B https://repl.it/repls/MessyCumbersomeVoxels
upvoted 3 times
...
davidrsr
5 years, 4 months ago
Note that a(0)=5 is not a valid statement and gives you error. It should be a[0]=5.
upvoted 4 times
...
zakhar
5 years, 5 months ago
python is declarative language. B still points to A, which points to [5,4,6]. the correct answer is B
upvoted 3 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago