exam questions

Exam PT1-002 All Questions

View all questions & answers for the PT1-002 exam

Exam PT1-002 topic 1 question 33 discussion

Actual exam question from CompTIA's PT1-002
Question #: 33
Topic #: 1
[All PT1-002 Questions]

Which of the following expressions in Python increase a variable val by one (Choose two.)

  • A. val++
  • B. +val
  • C. val=(val+1)
  • D. ++val
  • E. val=val++
  • F. val+=1
Show Suggested Answer Hide Answer
Suggested Answer: CF 🗳️

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
isaphiltrick
1 year, 8 months ago
It's C & F. This site explains it: https://www.prepbytes.com/blog/python/increment-operator-in-python/
upvoted 1 times
...
Anarckii
1 year, 11 months ago
Selected Answer: CF
C and F are correct
upvoted 1 times
...
bieecop
2 years, 5 months ago
Selected Answer: CF
C F That's correct.
upvoted 1 times
...
maps7
2 years, 11 months ago
correct answer is C and F
upvoted 1 times
...
brandonl
3 years, 1 month ago
++ is a no go in python. C and F.
upvoted 4 times
...
Adonist
3 years, 1 month ago
Selected Answer: CF
The ++ operator doesn't exist in python. The += works and also adding the variable + 1 into the variable as it shows in option C
upvoted 4 times
...
AirMaxG504
3 years, 3 months ago
I think the answer should be C& F https://pythonguides.com/increment-and-decrement-operators-in-python/
upvoted 4 times
Adonist
3 years, 1 month ago
AirMax is correct. Should be C and F
upvoted 1 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