Test your knowledge of Python
Posted on
March 8, 2017
by
How much do you know about the Python programming language?

When it comes to things we work with on a regular basis, we sometimes surprise ourselves by knowing more about a given topic than we thought we did. Just as often, however, we find ourselves surprised in the other direction. Given that, it can be both fun and informative sometimes to test your knowledge on certain topics.

The following twenty-five questions focus on the Python programming language, and range in difficulty from trivia to basic to complex. (Ever wondered what Python can do for you? Asked, and answered.) The answers appear at the end of the questions.

Good luck!

1. Which of the following was the creator of the Python programming language?
A. Eric Idle
B. Guido Van Rossum
C. Tim Ritchey
D. August Zehner

2. What is the last version of Python 2 that will be issued/supported?
A. 2.6
B. 2.7
C. 2.8
D. 2.9

3. Which of the following is NOT a valid variable name? (select all correct answers)
A. c
B. c7
C. 7c
D. c7c

4. In your program, the variable DAY is equal to an incrementing number you want to divide by YEAR and keep only the integer — ignoring any remainder. Which of the following will accomplish this?
A. DAY ** YEAR
B. DAY / YEAR
C. DAY mod YEAR
D. DAY // YEAR

5. In terms of precedence, which of the following operations will Python perform first if all appear on the same command line?
A. **
B. +
C. /
D. &

6. Objects in Python are created from templates that are known as:
A. Floats
B. Instances
C. Classes
D. Segments

7. Which of the following is used to convert other data types to strings in Python?
A. str()
B. string()
C. string.format()
D. to_string()

8. The string variable GIFTCARDS is currently equal to "29.95" and you want to extract only the right most digit. Which of the following will accomplish this?
A. right(GIFTCARDS,1)
B. GIFTCARDS[-1]
C. GIFTCARDS[1]
D. GIFTCARDS(right,1)

9. The string variable GIFTCARD is currently equal to "amazon" and you need to capitalize the first letter. Which of the following will accomplish this?
A. GIFTCARD.upper()
B. IC(GIFTCARD)
C. UC(GIFTCARD)
D. GIFTCARD.capitalize()

10. Which of the following is a mutable type of data?
A. float
B. str
C. bytes
D. list

11. The string BALL is comprised of alphabetic and numeric characters. Which of the following will return a value of TRUE?
A. istitle
B. isalnum
C. isdigit
D. isalpha
E. isspace

12. Which of the following command can be used to find out how many entries are in the list FLOWERS?
A. list (FLOWERS)
B. len( FLOWERS )
C. entries(FLOWERS)
D. FLOWERS.list

13. Which of the following are used to enclose dictionaries in Python?
A. { }
B. [ ]
C. ( )
D. <>

14. You need a "while" loop to process the next iteration without waiting for the end of the current loop. Which statement can be used to accomplish this?
A. break
B. jump
C. continue
D. bail

How much do you know about the Python programming language?

15. Which of the following statements is true?
A. If an argument is of a mutable type, it cannot be changed.
B. With immutable type arguments, the calling function is at the mercy of the called function.
C. An argument cannot be called by a function.
D. An argument cannot be declared to be constant by a called function.

Please visit GoCertify to attempt the remaining 10 questions of this quiz.





ANSWERS

1. B
2. B
3. C
4. D
5. A
6. C
7. A
8. B
9. D
10. D
11. B
12. B
13. A
14. C
15. D

About the Author

Emmett Dulaney is a professor at Anderson University and the author of several books including Linux All-in-One For Dummies and the CompTIA Network+ N10-008 Exam Cram, Seventh Edition.

Posted to topic:
Tech Know

Important Update: We have updated our Privacy Policy to comply with the California Consumer Privacy Act (CCPA)

CompTIA IT Project Management - Project+ - Advance Your IT Career by adding IT Project Manager to your resume - Learn More