WorksheetsPython & SQL
Total questions: 15
Worksheet time: 8mins
What is the correct syntax to output "Hello World" in Python?
print("Hello World")
p("Hello World")
print(Hello World")
printf("Hello World")
Which of the following is the correct way to create a list in Python?
my_list = <1, 2, 3>
my_list = {1, 2, 3}
my_list = (1, 2, 3)
my_list = [1, 2, 3]
How do you insert comments in Python code?
# This is a comment
// This is a comment
<!-- This is a comment -->
/* This is a comment */
What is the correct way to declare a variable in Python?
var x = 5
x = 5
int x = 5
declare x = 5
Which of the following is the correct way to define a function in Python?
function myFunction():
def myFunction():
define myFunction():
func myFunction():
Which one is NOT a legal variable name?
my-var
_myvar
myVar
my_var
What is the correct file extension for python files
.pyt
.pyth
.py
.pt
In python, 'Hello', is the same as "Hello"
False
True
What is the correct syntax to return the first character in a string
x = "Hello"[0]
x = sub("Hello", 0,1)
x = "Hello".sub(0,1)
Which collection is ordered, changeable, and allows duplicate members?
List
Tuple
Set
Dictionary
Which SQL statement is used to retrieve data from a database?
GET
OPEN
SELECT
EXTRACT
Which SQL keyword is used to sort the result-set?
ORDER BY
SORT BY
RRANGE BY
ORGANIZE BY
What does the SQL WHERE clause do?
It filters records
It changes records
It groups records
It sorts records
Which clause is used to combine rows from two or more tables, based on a related column between them?
JOIN
LINK
CONNECT
MERGE
How do you retrieve unique values from a column in SQL?
SELECT DISTINCT column_name FROM table_name;
SELECT UNIQUE column_name FROM table_name;
SELECT DIFFERENT column_name FROM table_name
SELECT SEPARATE column_name FROM table_name;
