Data Types Of Python Classwork

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Raja Marwah
R
Raja Marwah
Community Contributor
Quizzes Created: 2 | Total Attempts: 264
Questions: 16 | Attempts: 156

SettingsSettingsSettings
Data Types Of Python Classwork - Quiz

Read the questions very carefully and use PyCharm to solve these problems. Ask Teachers if you have any doubt.


Questions and Answers
  • 1. 

    Write a program code to print the type of 12

    Explanation
    The given program code uses the `type()` function to determine the type of the value `12`. The `type()` function returns the type of the object passed as its argument. In this case, `12` is an integer, so the program will output ``.

    Rate this question:

  • 2. 

    Write a program code to print the type of "123"+"123"

    Explanation
    The program code is using the "+" operator to concatenate the string "123" with the string "123". The result is the string "123123". The "type()" function is then used to determine the data type of this concatenated string, which is a string.

    Rate this question:

  • 3. 

    Write a program code to print the type of 12.5+12.5

    Explanation
    The given program code will print the type of the expression 12.5+12.5. The expression 12.5+12.5 performs addition on two float numbers, resulting in a float value of 25.0. The type() function is then used to determine the data type of the result, which in this case is a float.

    Rate this question:

  • 4. 

    Write a program code to print the type of(12+ 12)*(12)

    Explanation
    The given program code calculates the result of the expression (12+12)*(12) and then prints the type of the result. The expression first adds 12 and 12, resulting in 24. Then, it multiplies 24 by 12, resulting in 288. Finally, the type() function is used to determine the data type of the result, which is an integer.

    Rate this question:

  • 5. 

    What is an output of the following program code:num1 = 5num2 = 8print(type(num1 + num2))

    Explanation
    The program code defines two variables, num1 and num2, and assigns them the values 5 and 8 respectively. The print statement then outputs the type of the expression num1 + num2, which is the sum of the two variables. The output of this program code will be , indicating that the type of the sum is an integer.

    Rate this question:

  • 6. 

    What is an output of the following program code:num1 = 8num2 = 9print(type(num1*num2))

    Explanation
    The output of the given program code is . This is because the program multiplies the values of num1 and num2, which are both integers, resulting in an integer value. The type() function is used to determine the data type of the result, which is 'int' in this case.

    Rate this question:

  • 7. 

    What is an output of the following program code: num1 = 5 num2 = 2 print(type(num1/num2))

    Explanation
    The output of the program code is because when dividing two numbers in Python, the result is always a float, even if the division is between two integers. In this case, 5 divided by 2 is 2.5, which is a float. The `type()` function is used to determine the data type of a variable or expression, and it returns the data type as a string.

    Rate this question:

  • 8. 

    What is an output of the following program code: num1 = 55.5num2 = 5print(type(num1 + num2))

    Explanation
    The output of the program code is . This is because the variables num1 and num2 are both numbers, with num1 being a float (55.5) and num2 being an integer (5). When we add these two numbers together, the result will be a float. The type() function is used to determine the data type of the result, which in this case is a float.

    Rate this question:

  • 9. 

    What is an output of the following program code:num1 = 2num2 = 3print(type(num1**num2))

    Explanation
    The program code calculates the result of raising the value of num1 to the power of num2 using the exponentiation operator (**). The type() function is then used to determine the data type of the result. The output of the program will be , indicating that the result is an integer.

    Rate this question:

  • 10. 

    What is an output of the following program code:num1 = 345num2 = 390print(type(num1//num2))

    Explanation
    The output of the given program code is . This is because the "//" operator performs integer division and returns the quotient as an integer. In this case, the division of 345 by 390 results in a quotient of 0, which is an integer. The type() function is used to determine the data type of the result, which is 'int' in this case.

    Rate this question:

  • 11. 

    What is an output of the following program code: num1 = 25 num2 = 8 print(type(num1 % num2))

    Explanation
    The output of the program code is . This is because the modulus operator (%) is used to find the remainder when num1 is divided by num2. In this case, 25 divided by 8 gives a remainder of 1, which is an integer value. The type() function is used to determine the data type of the result, which is an integer.

    Rate this question:

  • 12. 

    What is an output of the following program code:num1 = 11num2 = 48print(type(num1*num2//num1))

    Explanation
    The output of the given program code is . This is because the program multiplies num1 and num2, and then performs integer division of the result by num1. The result of this calculation is an integer, which is confirmed by the type() function.

    Rate this question:

  • 13. 

    What is an output of the following program code: num1 = 5 num2 = 8 num3=6 print(type(num1 *(num2-num3)))

    Explanation
    The program code calculates the value of num2 minus num3, which is 2. Then, it multiplies the result by num1, which is 5. The output of this calculation is the product of num1 and the difference between num2 and num3, which is 10. The type() function is used to determine the data type of the result, which in this case is an integer.

    Rate this question:

  • 14. 

    What is an output of the following program code:num1 = 10num2 = 12num3 = 64print(type((num1-num2)**(num2-num1)//num3))

    Explanation
    The program code calculates the result of the expression (num1-num2) raised to the power of (num2-num1), divided by num3. The type() function is used to determine the data type of the result. The output of the program will be , indicating that the result is an integer data type.

    Rate this question:

  • 15. 

    What is an output of the following program code:num1 = 5num2 = 3print(num1**num2)

    Explanation
    The given program code calculates the result of raising the value of num1 (which is 5) to the power of num2 (which is 3) using the exponentiation operator (**). The result of 5 raised to the power of 3 is 125, which is the output of the program.

    Rate this question:

  • 16. 

    What is an output of the following program code:str1 = "Hello group1"str2 = " and group2"print(type(str1,str2))

    Explanation
    type() function takes only one value at a time

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 16, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 17, 2016
    Quiz Created by
    Raja Marwah
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.