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

Python Class IX Q&A Guide

Uploaded by

deveshsarsenda
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)
17 views3 pages

Python Class IX Q&A Guide

Uploaded by

deveshsarsenda
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

AMARCHAND SINGHVI INTERNATIONAL SCHOOL

CLASS VIII – COMPUTER SCIENCE


CH – 11
SOLVED EXERCISE
Work to be done in textbook
A. Fill in the blanks.
1. The symbol of ‘not equal’ relational operator is != .
2. The output of not(23<=54) is False .
3. The Input() statement is used to receive input from the user.

B. Write T for true statement and F for False one. Correct the False statement(s).
1. Double quotes can be used for multiline strings. True
2. The comment statement starts with “@” character. False
Correct statement: The comment statement starts with “#” character.
3. The print() function is used to get output on the screen. True.
C. Choose the correct option.
1. What will be the output of the following code:
x=5
y=7
x *= y * x + 10
a. 200 b. 215 c. 225 d. 220
2. Which one is an invalid variable?
a. _Num b. Perc% d. Firstname d. salary1
3. What will be the output of the following code?
A = 5.5
B=2
Print(A//B)
a. 2 b. 3 c. 2.0 d. 3.0

Descriptive Type Questions:


Answer the following.
1. What are the two modes to work in python?
Ans: There are two modes to work in python.
Interactive mode: In this mode a command is executed and gives output immediately after typing
it and pressing the enter key.

Class IX Computer Applications


Script mode: In script mode you can write a complete python program that has multiple lines
this can be saved as a program file you can then run the entire program in one go anytime you
want.
2. Which symbol is used for comments in python?
Ans: In python comment starts with # character.
3. How will you run a program in script mode?
Ans: Steps to run a program in script mode are:
1. Click File New file
2. In the new window that opens, type the program.
3. Save the program by clicking File  Save As. The Save As dialog box appears. Type the file
name and click Ok.
4. What is a keyword mention any two keywords in python?
Ans: keywords are reserve words that have a predefined meaning. They are easy to recognise in
ideally because they appear in orange. Some examples are and, del, def etc.
5. What is the difference between ‘\t’ and ‘\n’ (escape sequence characters)?
Ans: \n is the new line character, it moves the cursor to starting of next line.
\t is the horizontal tab character, It moves the cursor a tab width.
6. Why is python a popular programming language mention any four reasons.
Ans: Python is a popular programming language mainly due to the following reasons:
 It has a simple syntax and easy to learn.
 It is an interpreted language and therefore it is easy to debug.
 It is portable that is the code can run on different platforms like windows and LINUX
without any change.
 It is a free and open source language it is freely available for download from the website
http:// [Link].
7. What are the rules for naming a python variable?
Ans: Every variable in a program must have a unique name. following are the rules for a variable
in python:
 A variable can be of any length
 It can contain letters digits and or underscore.
 The first character must be a letter or an underscore and must not be a digit.
 Punctuation marks and spaces are not allowed in a variable name.
 Python is a case sensitive language therefore ‘total’, ‘Total and ‘TOTAL” are different
variable names.
 A keyword cannot be used as a variable.
Class IX Computer Applications
8. How will you assign single and multiple strings in python?
Ans: A string type of data (str) refers to a sequence of characters and numbers in single quotes or
double quotes. For multiple strings you can use triple single quotes or triple double quotes.
9. Name the data types available in python. Also mention whether they are mutable and
immutable.
Ans: In python, the data store in memory can be of the following types: Numbers, None,
Sequence, Sets, Mapping, Integers, float.
Data types in python can be mutable or immutable.
 The values in a mutable data type can be changed after they are created.
 The values in an immutable data type cannot be changed without changing their identity.
For a change in value in an immutable data type, a new memory location is allocated.
10. Define Arithmatic Operators.
Ans:
Arithmetic Operators: Arithmetic Operators are binary operators that perform mathematical
calculations.
Operator Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
** Exponent
// Floor division or
integer division

Class IX Computer Applications

Common questions

Powered by AI

Python's popularity is largely due to its simple syntax, which makes it easy to learn, and its interpreted nature simplifies debugging. Moreover, Python is portable, allowing code to run on different platforms like Windows and Linux without modification. It is also a free and open-source language, available for download from its official website, enhancing its accessibility .

Interactive mode is ideal for testing small code snippets rapidly and for prototyping. Script mode is better suited for writing full programs that require debugging and repeated execution. Thus, Interactive mode aids quick testing while Script mode supports structured development processes .

The expression 'x *= y * x + 10' involves compound assignment, first calculating 'y * x + 10', where y=7 and x=5, resulting in 45, then multiplying x by this value, so x becomes 225. The output is 225 .

Comments in Python are crucial for explaining code to others and for future reference. They are denoted using the '#' character and are not executed as part of the program, serving as annotations to improve code readability and maintenance .

In Python, mutable data types, such as lists and dictionaries, allow changes to their content without changing their identity. In contrast, immutable data types, like integers and strings, do not allow changes to their values once created—altering them results in a new object creation. Understanding these differences is essential for managing data efficiently in Python .

Improper variable naming can lead to difficult-to-read code and bugs due to Python's case sensitivity and the prohibition on using keywords. Adhering to naming conventions, like using descriptive variable names and following consistent letter casing, enhances code readability and maintenance, reducing the risk of errors .

In Python, a variable must have a unique name, can contain letters, digits, or underscores, and cannot start with a digit. Punctuation marks and spaces are not allowed, and keywords cannot be used as variable names. Python's case sensitivity means that 'total', 'Total', and 'TOTAL' are considered distinct, impacting how variables are managed and accessed in programming .

Python being free and open-source means it's accessible to anyone without cost, encouraging widespread adoption and contribution to its development. This open-source nature allows for a large user community actively participating in improving and sharing knowledge about Python, fostering innovation and support .

Python operates in two main modes: Interactive mode and Script mode. In Interactive mode, commands are executed immediately after they are entered, providing instant feedback. In Script mode, a complete Python program can be written across multiple lines and saved as a file, which can then be executed in one go .

In Python, the escape sequence '\n' represents the new line character, which moves the cursor to the start of the next line, creating a line break. On the other hand, '\t' represents the horizontal tab character, inserting a tab space, which helps in aligning text appropriately. These sequences are crucial for controlling text layout in outputs .

You might also like