Chapter-4 Computational Thinking & Programming in Python — Online MCQ Test
INFORMATION TECHNOLOGY · Grade 7 · CBSE(NCERT)
Practice Chapter-4 Computational Thinking & Programming in Python with a free chapter-wise online MCQ test.
This chapter covers: data types - variables - integer - float - string - if-else - for loop - while loop - Python syntax.
AI-generated questions from basic to board-exam level, with instant results and explanations.
Chapter-4 Computational Thinking & Programming in Python — Important Questions & Answers
What is a variable in Python?
- A. A named storage location that holds a value
- B. A mathematical equation
- C. A loop statement
- D. A function definition
Answer: A. A named storage location that holds a value
A variable is a named container that stores data values which can be used and modified throughout a program.
A variable is a named container that stores data values which can be used and modified throughout a program.
Which of the following is an integer data type?
- A. 3.14
- B. -25
- C. "Hello"
- D. 3.0
Answer: B. -25
An integer is a whole number without decimal points; -25 is a valid integer while 3.14 and 3.0 are floats.
An integer is a whole number without decimal points; -25 is a valid integer while 3.14 and 3.0 are floats.
What will be the output of: x = 5; print(x + 3)?
- A. 53
- B. 8
- C. 5 + 3
- D. Error
Answer: B. 8
The variable x holds value 5, and adding 3 to it gives 8, which is printed.
The variable x holds value 5, and adding 3 to it gives 8, which is printed.
What is the difference between a 'for' loop and a 'while' loop?
- A. For loops are faster than while loops
- B. For loops are used for a set number of iterations; while loops continue until a condition is false
- C. While loops cannot contain variables
- D. For loops can only work with strings
Answer: B. For loops are used for a set number of iterations; while loops continue until a condition is false
For loops iterate a predetermined number of times (often using range), while while loops repeat as long as a condition remains true.
For loops iterate a predetermined number of times (often using range), while while loops repeat as long as a condition remains true.
Considering computational thinking principles, which statement is TRUE about algorithm design?
- A. Algorithms must always use loops
- B. An algorithm is a step-by-step procedure to solve a problem
- C. Algorithms can only be written in Python
- D. All algorithms require conditional statements
Answer: B. An algorithm is a step-by-step procedure to solve a problem
An algorithm is a logical sequence of instructions; while loops and conditionals are tools, not requirements for all algorithms.
An algorithm is a logical sequence of instructions; while loops and conditionals are tools, not requirements for all algorithms.