What is the final result of the expression 4 + 5 * 3?, 27, 12, 21, 19, What is the final result of the expression 7 / 2 + 6?, 0, 9.5, 9, 0.875, Choose the print statement below that will cause an error. Assume num = 6 and name = "Isabella"., print(name + ":")\nprint(num), print(name + " wants " + "num " + "candies"), print(name + ": " + str(num)), print(name + ": " + num), Which statement below will cause an error?, ans = "hi" * 8, ans = "hi" + 9, ans = "hi" + "hi" + "hi", ans = ("a" * 4) + "b", What does the following program print? a = "hi" b = 4 c = a * b print(type(c)), A. <class 'str'>, B. <class 'int'>, C. <class 'float'>, The program crashes., Suppose you have a variable defined as: a = "4" a = "4" What is the variable type of a?, str, int, float, number, Choose the option that correctly prints out the variable(s)., x = "codehs"print(int(x)), num = 8\nprint("num"), name = "Alyx"\nage = 32\nprint(name + "is " + age), language = "Python"\nprint("I'm learning " + language), What kind of data does a float variable contain?, Whole numbers, Words, Numbers with decimal components, A float is not a Python variable type, What does the following code print? x = 3.4 y = 1 print(int(x)) print(x + y), 3.4\n4.4, 3\n4.4, 3\n4, The code causes an error, Which is the best way to get a number from the user for a mathematical equation?, num = str(input("Enter a number: ")), num = number(input("Enter a number: ")), num = input("Enter a number: "), num = int(input("Enter a number: ")), What is the final result of the expression 2**3?, 6, 8, 2, Invalid Python expression, What character do Python comments begin with?, #, %, -, ", What is the difference between a binary operator and a unary operator?, Computers can use binary operators, but not unary operators., A unary operator needs two things, while a binary operator needs one., A binary operator needs two things, while a unary operator needs one., Binary operators are for arithmetic, unary operators are for strings., On which line will Python produce an error? weight = input("How much do you weigh? ") oz_water = weight / 2 print("You should drink " + str(oz_water)) print("ounces of water every day if you weigh " + weight), Line 1, Line 2, Line 3, Line 4, In what order should these statements be executed? A) response = input("Do you like cheese? ") B) print("You have chosen " + confirm) C) print("You responded " + response) D) confirm = input("Are you sure? "), A, B, C, D, B, C, A, D, A, C, D,B, C, B, A, D, What is the output of the following program if the user enters "Florence" and "Fernandez"? first_name = input("What is your first name? ") last_name = input("What is your last name? ") whole_name = first_name + last_name print(whole_name), Fernandez Florence, Florence\nFernandez, FlorenceFernandez, Florence Fernandez, Which is a properly formed Python variable name?, user_age, uSeRaGe, user!age!, 1user_age, Which of the following is NOT a Python variable type?, int, str, float, number, Choose the correct declaration of a float variable with the value 3.14., pi = "3.14", pi = int(3.14), pi = 3.14, float pi = 3.14.

Python Basics Multiple Choice Questions

על ידי

לוח תוצאות מובילות

סגנון חזותי

אפשרויות

משודרג בינה מלאכותית: פעילות זו מכילה תוכן שנוצר על ידי בינה מלאכותית. למד עוד.

החלף תבנית

)
האם לשחזר את הנתונים שנשמרו באופן אוטומטי: ?