Any2Quiz
CBSE / 9 / ICT / Programming Basics

Simple Python Programs Quiz - CBSE Class 9 ICT

Free practice quiz: Simple Python Programs (CBSE Class 9 ICT). 19 multiple-choice questions with answers and explanations. Play online, no sign-up needed.

Play all 19 questions free

Sample questions

  1. What is the correct output of the following code: print('Hello World')?

    1. Hello
    2. Hello World
    3. Hello World!
    4. Hello, World!
    Show answer

    Answer: B. Hello World

    The print function outputs the string as it is provided within the quotes. Therefore, the correct output is 'Hello World'.

  2. Which of the following data types is mutable in Python?

    1. Tuple
    2. String
    3. Set
    4. Integer
    Show answer

    Answer: C. Set

    Among the given data types, a set is mutable, meaning its contents can be changed after it is created.

  3. What is the result of the expression: 10 // 3?

    1. 3
    2. 3.33
    3. 4
    4. 30
    Show answer

    Answer: A. 3

    The // operator in Python performs floor division, which discards the fractional part and returns the largest integer less than or equal to the division result.

  4. What is the result of the expression: [1, 2, 3] * 2?

    1. [1, 2, 3, 1, 2, 3]
    2. [2, 4, 6]
    3. [1, 2, 3]
    4. [1, 2, 3, 2]
    Show answer

    Answer: A. [1, 2, 3, 1, 2, 3]

    The * operator when used with lists repeats the list. Thus, [1, 2, 3] * 2 gives [1, 2, 3, 1, 2, 3].

  5. Which of the following constructs can be used to create a function in Python?

    1. function
    2. def
    3. define
    4. func
    Show answer

    Answer: B. def

    In Python, the 'def' keyword is used to define a function.

Take the full quiz

More quizzes

Browse all Programming Basics quizzes