Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 30 pages
Exam (elaborations)

Python for IT Automation Practice Exam With correct answers and rationale updated 2026 graded a+

Document preview thumbnail
Preview 3 out of 30 pages

Python for IT Automation Practice Exam With correct answers and rationale updated 2026 graded a+

Content preview

Python for IT Automation Practice Exam
With correct answers and rationale
updated 2026 graded a+


1. What is the correct way to assign the string "hello" to a variable named greeting?

A. string greeting = "hello"

B. greeting <- "hello"

C. greeting = "hello"

D. var greeting = "hello"



Answer: C

Rationale: Python uses = for assignment and does not require variable type declarations.



2. Which data type is immutable in Python?

A. List

B. Dictionary

C. Set

D. Tuple



Answer: D

Rationale: Tuples cannot be modified after creation, while lists, dictionaries, and sets are mutable.



3. What will print(type(5)) display?

A. <type int>

B. <class 'int'>

C. int

D. integer



Answer: B

,Rationale: In Python 3, type(5) returns <class 'int'>.



4. Which of the following creates a list?

A. {1, 2, 3}

B. (1, 2, 3)

C. [1, 2, 3]

D. <1, 2, 3>



Answer: C

Rationale: Square brackets define a list in Python.



5. What is the result of 3 + 2 * 4?

A. 20

B. 11

C. 14

D. 24



Answer: B

Rationale: Multiplication happens before addition, so 2 * 4 = 8, then 3 + 8 = 11.



6. Which statement is used to make decisions in Python?

A. switch

B. select

C. if

D. case



Answer: C

Rationale: Python uses if, elif, and else for conditional logic.



7. What is the output of print("7" + "3")?

A. 10

, B. 73

C. 7 3

D. Error



Answer: B

Rationale: Both operands are strings, so + concatenates them.



8. Which loop is best when you know how many times you want to repeat?

A. while

B. for

C. repeat

D. do-while



Answer: B

Rationale: A for loop is commonly used when iterating over a known sequence or range.



9. What does len("python") return?

A. 5

B. 6

C. 7

D. Error



Answer: B

Rationale: The string "python" contains 6 characters.



10. Which of the following is a valid Python comment?

A. // comment

B. <!-- comment -->

C. # comment

D. ** comment **

Document information

Uploaded on
September 15, 2026
Number of pages
30
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$24.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
184
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions