






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Which of the following Python 3 instructions will produce the output Hello World? Print("Hello World") print "Hello World" print "Hello World" print("Hello World") - ANSWERS-print("Hello World") What character(s) is used at the start of a line in Python to indicate that what follows should be treated as a comment? - ANSWERS-# Which of the following is a type in Python? int bool list All of the above - ANSWERS-All of the above A fragment of code that causes a data type to be evaluated? - ANSWERS- Expression A single unit of code that the Python interpreter can execute? - ANSWERS- Statement
What is the output of the following code in Python 3? print(1 and 0) - ANSWERS- If we have just 1 + 1 what are the outcome in command prompt (Shell Mode) and script? - ANSWERS-2 and blank This control structure in Python keeps executing a code block while the test is True? - ANSWERS-While loop Python keyword used to create a user function? - ANSWERS-def This control structure in Python executes a code block for a specified number of times? - ANSWERS-For loop What will be the result of the following Python 3 statement? temperature = "3" + "5" - ANSWERS-' 35 ' What will be the output of the following code in Python 3? number = 6 number = number + 4 lucky_number = 10 * number print(lucky_number/number) - ANSWERS- What is the output of the following code in Python 3? print("Ozymandius"[2:4]) - ANSWERS-ym
return 1 else: return n * factorial(n-1) print(factorial(3)) - ANSWERS- Standard language for managing and querying relational databases? - ANSWERS-SQL Behaves much like a list, but permits non-integer types to be used as the indices. Can be thought of as a set of non-sequential key-value pairs. - ANSWERS-Dictionary Items in a dictionary are... - ANSWERS-unordered so they cannot be referenced using their ordinal position...the actual order of the items is unpredictable. What results from "3" + "5"? Why? - ANSWERS-' 35'. Because they are surrounded by quotation marks, the interpreter treats the values as letters and concatenates them. What is 6 + 10 / 2? What is it called when calculation is correct but not meant for this result? - ANSWERS-11. Semantically Incorrect. Consider the following: lucky_number = 42 print(lucky_number) 42
What is lucky_number in this case? - ANSWERS-A variable: gives a name to a value. Consider the following: lucky_number = lucky_number * 2 print(lucky_number) 84 What happened? - ANSWERS-Assigned value of lucky_number * 2 to variable lucky_number. This changes the value of the variable lucky_number. Variable names are case sensitive. Single unit of code that the Python interpreter can execute - ANSWERS- Statement Any fragment of code that causes a data type to be evaluated - ANSWERS- Expression What are the different types in Python? - ANSWERS-Integer, Floating Point Number, String, Boolean, List Data type for text and contained within quotation marks - ANSWERS-String; can consist of: Letters (both uppercase and lowercase); numbers; special characters; spaces; or combo of above What is the difference/similarities between string and list - ANSWERS-String data types consist of a sequence of characters. They are similar to the list data type. The main difference between the two is that a list can contain any data type, while string can only contain characters.
What is the basic syntax of a Method? - ANSWERS-Dot notation: