Docsity

WGU D335 INTRO TO PYTHON OA OBJECTIVE, Exams of Nursing

Toggle sidebar
bg1
WGU D335 Intro to Python | OA | Objective
Assessment | 100 Updated & Actual
Questions and 100% Correct Answers |
2026/2027
SECTION 1: Python Basics & Syntax (Q1โ€“25)
1. Which symbol is used for comments in Python?
A. //
B. /* */
C. #
D. --
Answer: C
Explanation: Python uses # for single-line comments.
2. Which function outputs text to the console?
A. echo()
B. print()
C. output()
D. write()
Answer: B
Explanation: print() displays output in Python.
3. Which of the following is a valid variable name?
....
Page 1 of 19
2026/2027
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download WGU D335 INTRO TO PYTHON OA OBJECTIVE and more Exams Nursing in PDF only on Docsity!

WGU D335 Intro to Python | OA | Objective

Assessment | 100 Updated & Actual

Questions and 100% Correct Answers |

SECTION 1: Python Basics & Syntax (Q1โ€“25)

1. Which symbol is used for comments in Python? A. // B. /* */ C. # D. -- Answer: C Explanation: Python uses # for single-line comments. 2. Which function outputs text to the console? A. echo() B. print() C. output() D. write() Answer: B Explanation: print() displays output in Python. 3. Which of the following is a valid variable name?

A. 2value B. my-value C. my_value D. class Answer: C Explanation: Variable names cannot start with numbers or be keywords.

4. What is the output of the following code? print(type( 10 )) A. int B. integer C. D. number Answer: C Explanation: Python displays data types using class notation. 5. Which data type stores text? A. int B. float C. str D. bool **Answer: C

  1. What is the value of x after execution?** x = 5

D. float(x) Answer: B

10. Which keyword defines a function? A. func B. define C. def D. function **Answer: C SECTION 2: Conditionals (Q26โ€“50)

  1. Which keyword handles additional conditions?** A. else B. elif C. then D. when **Answer: B
  2. What is the output?** x = 10 if x > 5 : print("A") else: print("B")

A. A

B. B

C. Error D. Nothing Answer: A

28. Which comparison checks inequality? A. == B. >= C. != D. <= **Answer: C

  1. What does this print?** if False: print("Yes") else: print("No") A. Yes B. No C. Error D. Nothing **Answer: B
  2. Boolean values are:**

34. Which keyword ends a conditional block? A. end B. stop C. Indentation D. break **Answer: C

  1. Which statement executes if all conditions fail?** A. if B. elif C. else D. when **Answer: C SECTION 3: Loops (Q51โ€“80)
  2. Which loop repeats a known number of times?** A. while B. for C. do-while D. repeat **Answer: B
  3. What does this print?** for i in range( 3 ):

print(i) A. 1 2 3 B. 0 1 2 C. 0 1 2 3 D. Error Answer: B

53. Which keyword stops a loop immediately? A. stop B. end C. break D. exit **Answer: C

  1. Which keyword skips to the next iteration?** A. skip B. next C. continue D. pass **Answer: C
  2. What is the output?** x = 0 while x < 3 : print(x)

59. Which loop checks condition before execution? A. for B. while C. repeat D. do **Answer: B

  1. What does pass do?** A. Ends loop B. Skips iteration C. Does nothing D. Causes error **Answer: C SECTION 4: Functions (Q81โ€“105)
  2. What is a function?** A. Variable B. Loop C. Reusable block of code D. Condition **Answer: C
  3. What keyword returns a value?** A. send B. output

C. return D. give Answer: C

83. What is printed? def add(a, b): return a + b print(add( 2 , 3 )) A. 2 B. 3 C. 5 D. Error **Answer: C

  1. Parameters are:** A. Values returned B. Variables in function definition C. Function calls D. Data types **Answer: B
  2. Arguments are:** A. Variables B. Returned values

def f(x= 5 ): A. Error B. Required parameter C. Optional parameter D. Loop Answer: C

90. How many values can a function return? A. One B. Two C. Unlimited D. None **Answer: C SECTION 5: Data Structures (Q106โ€“130)

  1. Which structure stores ordered items?** A. Set B. Dictionary C. List D. Boolean **Answer: C
  2. Which structure is immutable?** A. List B. Tuple C. Dictionary

D. Set Answer: B

108. How do you access first list element? lst = [ 10 , 20 , 30 ] A. lst(0) B. lst[1] C. lst[0] D. lst.first() **Answer: C

  1. What does append() do?** A. Removes item B. Adds item to end C. Sorts list D. Clears list **Answer: B
  2. Dictionaries store data as:** A. Indexes B. Values only C. Key-value pairs D. Sets **Answer: C
  3. How do you access dictionary value?**

115. Indexing starts at: A. 1 B. - 1 C. 0 D. Any **Answer: C SECTION 6: Strings, Errors & Final Concepts (Q131โ€“150)

  1. Strings are:** A. Mutable B. Immutable C. Loops D. Integers **Answer: B
  2. What does upper() do?** A. Removes spaces B. Capitalizes string C. Converts to uppercase D. Reverses string **Answer: C
  3. What causes a syntax error?** A. Logic mistake B. Incorrect indentation

C. Misspelled keyword D. All of the above Answer: D

134. What is a runtime error? A. Compile issue B. Error during execution C. Syntax issue D. Comment issue **Answer: B

  1. What does try/except handle?** A. Loops B. Input C. Errors D. Output **Answer: C
  2. Which converts string to float?** A. float(x) B. str(x) C. int(x) D. bool(x) **Answer: A
  3. What does strip() do?**

141 โ€“ 150: Final Exam Logic (Rapid Review)

  1. Python is case-sensitive โ†’ True
  2. = assigns values โ†’ True
  3. == compares values โ†’ True
  4. Lists are mutable โ†’ True
  5. Tuples are immutable โ†’ True
  6. Dictionaries use keys โ†’ True
  7. Indentation defines blocks โ†’ True
  8. input() returns string โ†’ True
  9. Functions improve reusability โ†’ True
  10. D335 OA tests problem-solving โ†’ True