Intro to Python-Final Exam-INT-2240

Intro to Python-Final Exam-INT-2240

Intro to Python-Final Exam-Question 1

Which of the following is a Python keyword?

variable

if

string

function

Question 2

Which of the following is a data type in Python?

loop

sequence

integer

operator

Question 3

What symbol is used to start a single-line comment in Python?

#

//

/*

<!–

Question 4

Which of the following is a valid variable name in Python?

2var

my_variable

$test

python-code

Question 5

What is the result of 5 + 3?

8

15

2

53

Question 6

Which operator is used to check if two values are equal in Python?

==

=

<=

!=

Question 7

What is the syntax for an if statement in Python?

if condition { }

if (condition) { }

if condition:

if (condition):

Question 8

What is the result of “hello” + “world” in Python?

hello world

helloworld

hello_world

hello + world

Question 9

How do you define a function in Python?

function my_function():

define my_function():

function my_function:

def my_function():

Question 10

Which of the following represents the Boolean value True in Python?

true

FALSE

Question 11

What loop construct is used to iterate over a sequence in Python?

repeat

while

for

loop

Question 12

Which method is used to convert a string to uppercase in Python?

toUpper()

upper()

uppercase()

capitalize()

Question 13

How do you get user input in Python?

input()

get_input()

read_input()

user_input()

Question 14

Which method is used to add an element to the end of a list in Python?

add()

push()

append()

insert()

Question 15

Which operator is used to check if one value is less than another in Python?

<

>

==

<=

Question 16

How do you define a function with parameters in Python?

def my_function():

define my_function():

def my_function(parameter1, parameter2):

function my_function(parameter1, parameter2):

Question 17

How do you assign a value to a variable in Python?

variable = value

value = variable

variable(value)

set variable to value

Question 18

Which loop construct is used when the number of iterations is known in advance?

for loop

while loop

repeat loop

until loop

Question 19

What is the result of True and False in Python?

True

False

None

Error

Question 20

How do you return a value from a function in Python?

return value

return

value

return(value)

Answer Preview-Intro to Python-Final Exam-INT-2240

Intro to Python-Final Exam-INT-2240

$5.00

Posted

in

by

Tags: