1) In Python, what is the purpose of the input() function when used with a variable? a) To display output b) To perform mathematical calculations c) To read user input d) To define a new variable 2) Which of the following is a correct way to concatenate two strings stored in variables name1 and name2? a) name1 + name2 b) join(name1, name2) c) concat(name1, name2) d) merge(name1, name2) 3) What is the data type of the variable in the following statement: price = 29.99? a) Integer b) Float c) String d) Boolean 4) Which of the following is a correct way to assign a value to a variable in Python? a) x = 5 b) x := 5 c) value 5 to x d) x >> 5 5) What is the purpose of the if statement in Python? a) To declare a variable b) To perform conditional execution of code c) To create a loop d) To print output 6) In an if-else statement, what happens if the condition in the if block is not met? a) The else block is executed b) An error occurs c) The program terminates d) The if block is re-evaluated 7) How can multiple conditions be combined in an if statement? a) Using the or keyword b) Using both or and and c) Using the and keyword d) Only one condition is allowed 8) What is the purpose of the elif statement in Python? a) To declare a new variable b) To print output c) To handle multiple conditions d) To end the program 9) What is the role of indentation in Python's if-else statements? a) It is optional and does not affect the code b) It is required to define the scope of the code blocks c) It is used for decoration d) It causes errors

Κατάταξη

Οπτικό στυλ

Επιλογές

Αλλαγή προτύπου

Επαναφορά αυτόματα αποθηκευμένου: ;