0% found this document useful (0 votes)
190 views3 pages

Class 7 Computer Chapter 6 Exercises

Uploaded by

priyankati778
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
190 views3 pages

Class 7 Computer Chapter 6 Exercises

Uploaded by

priyankati778
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON

EXERCISE
A. Tick ( ) the correct answer.
1. Who created Python in late 1980s?
a) Guido von Rosum b) Guido van Rossum c) Monty Python
2. The primary prompt in Python is ___________.
a) >>> b) >> c) >=
3. Python is processed at run time by a/an ____________.
a) compiler b) assembler c) interpreter
4. ____________ is the grammar of a programming language.
a) Syntax b) Syntax Error c) Virus
5. Syntax Error is also known as ____________.
a) Worm b) Virus c) Bug

B. Fill in the blanks.


1. In Python, you can save program in script mode.
.py extension.
3. Print mode in Python is used to create souce code.
4. Comments start with # sign.
5. F5 is the shortcut key to run a program in Python.

C. Write True (T) or False (F).


1. Python is a case sensitive language.
2. In Python, anything written after # is printed as it is.
3. Script mode performs as a calculator is Python.
4. Python uses ( \ ) character to denote that a line should continue.
5. You can save program in the Interactive mode of Python IDLE.

A. Python was developed by Guido van Rossum.

16
A. IDLE is an acronym of Integrated Developement Environment.

A. print ( ) function displays the result.

A. Interactive Mode,as the name suggests, allows to interact with OS. It is convenient for the
beginners to work and for testing codes.

more than few lines, so as to save the code, modify and reuse it.

A. Print() function evaluates the expression before printing it on the monitor. It is a function,

entire line and then goes to next line for subsequent output (s).

A.
ii) It allows editing and running program from a single interface.
iii) Interactive environment makes it easy to write program.

A.
ignored by interpreter, i.e. it will not have any effect on the program. A comment can
appear on a line by itself or they can also be at the end of line.

1. >>> print 20 + 40
A.

A.

A.

A. Print (177/7)

A. Script Mode.
17
Mr. A , Mr. B, Mr. C and Mr. D are four teachers of a school. Mr. A can teach English as
well as Maths but not Hindi. Mr. B can teach English only. Mr. C can teach English as well

A B C D
English
Hindi
Maths

a) 2 b) 3 c) 4
2. How many teachers can teach English?
a) 2 b) 3 c) 4

a) Maths b) English c) Hindi

18

Common questions

Powered by AI

Guido van Rossum is credited with the creation of the Python programming language in the late 1980s . The name 'Python' is derived from 'Monty Python', indicative of van Rossum's interest in the British comedy group, which influences the language's community culture by fostering a sense of humor and approachability in the technology realm .

Python code is executed by an interpreter, which processes the code at runtime rather than compiling it in advance. This allows for immediate execution and easy debugging, making it particularly suited for rapid development and testing .

Python's case sensitivity affects programming practices by enforcing precise naming conventions for variables, functions, and classes. This can prevent logical errors since 'Variable' and 'variable' would be treated as distinct identifiers, helping maintain clear and maintainable code. It also requires programmers to be cautious and consistent in names, reducing potential errors that could arise from typos .

The print() function in Python is crucial for displaying the output of expressions, providing feedback to the user during program execution. It evaluates expressions before printing, allowing for straightforward representation of data on the console. By handling subsequent lines in the output efficiently, it supports comprehensive output management in scripts, making debugging and interaction intuitive and accessible .

Comments in Python, which begin with a '#' sign, play an essential role in increasing code readability and maintainability. They provide documentation and explanations within the code, helping programmers and collaborators understand the intent behind code segments without executing them . Comments can also be used to temporarily disable code for testing purposes, offering flexibility in code modifications and debugging .

A syntax error in Python occurs when the language grammar is violated, for example, missing colons, mismatched parentheses, or incorrect indentation. This is distinctly different from logical errors or runtime errors, which occur due to incorrect algorithm implementation or operations performed on incompatible data types. Syntax errors prevent code execution until corrected, emphasizing the importance of precision in code write-ups .

The ability of a single teacher to educate in multiple subjects, as illustrated by Mr. A's capability in both English and Maths, suggests increased teaching flexibility and resource efficiency within educational institutions. It allows for optimized teacher allocation, potentially reducing the number of specialized teachers needed and fostering holistic educational approaches. This versatility supports student engagement by promoting interdisciplinary learning and simplifying scheduling .

Interactive Mode in Python, often accessed via the Python shell, serves as an environment where users can test snippets of code quickly and see immediate results. This function benefits new programmers by allowing them to experiment with code execution and results in real-time without needing to create full scripts, facilitating learning and understanding of language features without dealing with files .

The term 'Bug' metaphorically reflects the obstacles or 'infectious' issues within code that prevent it from functioning correctly, akin to a pest disturbing a system. In Python, as in other languages, bugs undermine expected program logic and outputs, necessitating debugging processes for resolution. The terminology highlights the unpredictable nature of such errors and the need for metaphorical 'infestation' management within software development .

The continuation character '\' in Python allows a single logical line of code to span multiple physical lines. This aids in organizing lengthy code statements across several lines for improved readability and maintenance without violating syntax protocols, facilitating structured coding and better visualization of program flow .

You might also like