placeholder image to represent content

Python Intro (Week 1-2)

Quiz by H L

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
10 questions
Show answers
  • Q1

    What is the output from the following segment of code:

    print('Hello World')

    Hello World

    None of the mentioned

    Syntax error found on code

    Hello world

    30s
  • Q2

    Which of the following prints the following output:

    Hello

    How are you?

            Good to know you

    print('Hello\nHow are you?\n\tGood to know you')

    print('Hello\nHow are you?\tGood to know you')

    print('Hello\t\nHow are you?\t\nGood to know you')

    print('Hello\n\tHow are you?\n\tGood to know you')

    30s
  • Q3

    Python IDLE offers Interactive and Development modes.

    True

    False

    30s
  • Q4

    What is the output from the following segment of code:

    string1 = 'Hello World'

    print('string1[2:5]')

    string1[2:5]

    llo

    ello

    lo

    30s
  • Q5

    If the user input value is 'Travis', what is the output from the following segment of code:

    userName = input("What is your name? ")

    print("Hello", username)

    Hello,Travis

    Hello Travis

    HelloTravis

    Syntax error found on code

    30s
  • Q6

    If the user input values are 5 and 7, what is the output from the following segment of code:

    num1 = input("Enter first number: ")

    num2 = input("Enter second number: ")

    n_sum = num1 + num2

    print("The sum is " + n_sum)

    7

    Syntax error found on code

    57

    5

    30s
  • Q7

    If the user input value is 3, what is the output from the following segment of code:

    num1 = int(input("Enter first number: "))

    print("The square of " + str(num1) + " is " + str(num1*num1))

    The square of 3 is 9

    None of the mentioned

    The square of str(3) is str(9)

    The square is 9

    30s
  • Q8

    What is the output from the following segment of code:

    string1 = 'Python Programming'

    print(string1[-4:])

    ming

    Pyth

    Pyt

    ing

    30s
  • Q9

    Which of the following is invalid?

    None of the mentioned

    __a__ = 1

    _a_ = 1

    _a = 1

    30s
  • Q10

    Which of the following is true for variable names in Python?

    Must have leading and trailing underscores

    Unlimited length

    Underscore and ampersand are the only two special characters allowed

    None of the mentioned

    30s

Teachers give this quiz to your class