All Exams  >   Class 9  >   Computer Applications for Class 9  >   All Questions

All questions of Introduction to Python for Class 9 Exam

The return value for trunc() would be:
  • a)
     bool
  • b)
     float
  • c)
    int
  • d)
    None
Correct answer is option 'C'. Can you explain this answer?

Rajshree Menon answered
Explanation:

trunc() Function:
- The `trunc()` function is used in Python to remove the decimal part of a number and return the integer part of the number.
- It does not round off the number but simply truncates it towards zero.

Return Value:
- The return value for `trunc()` is an integer.
- It returns the integer part of the input number after removing the decimal part.
- This integer part is returned as the output of the function.
Therefore, the correct answer is option 'C' (int).

What does 15 % 2 evaluate to?
  • a)
    0
  • b)
    1
  • c)
    2
  • d)
    3
Correct answer is option 'B'. Can you explain this answer?

Nilanjan Ghosh answered
Question:
What does 15 % 2 evaluate to?

Answer:
The expression 15 % 2 is a mathematical operation in which the modulo operator (%) is used to find the remainder when the number 15 is divided by 2.

Explanation:
To understand the evaluation of 15 % 2, let's break it down step by step:

Step 1: Division
Divide 15 by 2:
15 ÷ 2 = 7 with a remainder of 1

Step 2: Modulo Operator
The modulo operator (%) returns the remainder of a division operation. In this case, the remainder is 1.

Step 3: Evaluation
Therefore, the expression 15 % 2 evaluates to 1.

Final Answer:
The value of 15 % 2 is 1.

Key Points:
- The modulo operator (%) is used to find the remainder of a division operation.
- In this case, dividing 15 by 2 gives a quotient of 7 and a remainder of 1.
- The expression 15 % 2 evaluates to 1.

Chapter doubts & questions for Introduction to Python - Computer Applications for Class 9 2025 is part of Class 9 exam preparation. The chapters have been prepared according to the Class 9 exam syllabus. The Chapter doubts & questions, notes, tests & MCQs are made for Class 9 2025 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests here.

Chapter doubts & questions of Introduction to Python - Computer Applications for Class 9 in English & Hindi are available as part of Class 9 exam. Download more important topics, notes, lectures and mock test series for Class 9 Exam by signing up for free.

Top Courses Class 9

Signup to see your scores go up within 7 days!

Study with 1000+ FREE Docs, Videos & Tests
10M+ students study on EduRev