Computer Science and Entrepreneurship Python Programming Python Modules and Built-in Data Structures Medium Q1. What does add(3, 5) return if def add(a,b): return a + b? 35 8 15 53
Computer Science and Entrepreneurship Python Programming Python Modules and Built-in Data Structures Medium Q2. Which keyword is used to define a function in Python? define def function fun
Computer Science and Entrepreneurship Python Programming Python Modules and Built-in Data Structures Medium Q3. What is a Python module? A variable storing a number A way to define a loop A built-in data type like int or str A file containing functions, variables, etc
Computer Science and Entrepreneurship Python Programming Control Structures Medium Q4. What is the output of the provided nested conditional code? temperature, humidity, wind_speed = 25, 60, 15 print("Hot" if temperature > 30 and humidity > 50 else "Warm" if temperature == 25 and wind_speed > 10 else "Cool" if temperature < 20 and humidity < 30 else "Moderate") Hot Warm Cool Moderate
Computer Science and Entrepreneurship Python Programming Control Structures Medium Q5. What does the range() function do in Python? Generates a list of numbers Creates a sequence of numbers Calculates the sum of numbers Prints a range of numbers
Computer Science and Entrepreneurship Python Programming Control Structures Medium Q6. Which loop type is used to iterate over a collection such as lists? while for do-while repeat
Computer Science and Entrepreneurship Python Programming Control Structures Medium Q7. Purpose of range() function? Repeat function Generate numbers Create loop Handle arrays
Computer Science and Entrepreneurship Python Programming Control Structures Medium Q8. Correct syntax for for loop? for each statement in a sequence for variable in range() for loop in sequence for variable in condition
Computer Science and Entrepreneurship Python Programming Control Structures Medium Q9. Which loop runs while condition is true? For loop While loop Until loop For each loop
Computer Science and Entrepreneurship Python Programming Control Structures Medium Q10. What is loop used for? Run code once Make decisions Repeat actions Generate numbers