15 questions • Select the best answer for each question
What does the input() function do?
What is the data type of input received using input()?
What will be the output? age = input("Enter age: ") print(type(age))
Which line correctly converts user input to an integer?
What will happen? num1 = input("Enter number: ") num2 = input("Enter number: ") print(num1 + num2) User enters: 5 and 3
How do you fix the previous code to get 8?
What will this print? price = float(input("Enter price: ")) qty = int(input("Enter quantity: ")) print(price * qty)
Which is the correct way to print user data using f-strings?
What will this code do? password = input("Enter password: ") if len(password) >= 8: print("Valid password") else: print("Invalid password")
Why is validation usually written inside a function?
Which function correctly validates password length? def is_valid(password): return len(password) >= 8
What does this function return? def check_age(age): if age >= 18: return "Adult" return "Minor" If age = 20
Which creates a multi-line formatted output?
Which is best for a Client Registration Form?
Which statement is TRUE?