Python Fundamentals

    Last Updated :
    Discuss
    Comments

    Question 1

    Which of the following is a valid way to comment in Python?

    • // This is a comment

    •  # This is a comment

    • <!-- This is a comment -->

    •  /* This is a comment */

    Question 2

    What is the result of the following expression in Python: 5 + 2 * 3

    • 21

    • 17

    • 11

    • 1

    Question 3

    What will be the output of the following code snippet?

    Python
    a = 5
    b = 2
    print(a // b)
    
    • 2.5
       

    • 2

    • 2.0

    • 2.00

    Question 4

    What is the output of the following code?

    Python
    num1 = "5"
    num2 = 3
    result = num1 * num2
    print(result)
    
    • 15

    • "555"

    • 8

    • "333"

    Question 5

    What is the output of the following code?

    Python
    value = 2 + 3 * 4 / 2
    print(value)
    
    • 4.5

    • 10.0

    • 8.0

    • 12.0

    Question 6

    What is the output of the following code?

    Python
    x = "5"
    y = "2"
    print(x + y)
    
    • 7
       

    • 52

    • 10

    • 3

    Question 7

    Which of the following statements is true about Python variables?

    • Variables must be declared before they are used.

    • Variables can contain only letters.

    • Python variables are case-sensitive.

    • Python variables cannot be reassigned.

    Question 8

    Which of the following is the correct way to take user input in Python?

    • input()

    • get_input()

    • user_input()

    • read_input() 

    Question 9

    Which of the following is the correct type conversion for converting a floating-point number to an integer in Python?

    • int(float_num)

    • integer(float_num)

    • float_to_int(float_num)

    • convert_int(float_num)

    Question 10

    What is the value of result in the following code?

    Python
    num = "8"
    result = int(num) + 5
    print(result)
    
    • 13
       

    • "85"

    • 58

    • "13"

    There are 15 questions to complete.

    Take a part in the ongoing discussion