Kips Class 7 Cyber Apps Chapter 6 Introducing Python

Chapter 6 Introducing Python

Brain Developer
A. Fill in the blanks:
1. Syntax refers to the grammatical rules to be followed while writing a program in any language.
2. Python was created by Guido Van Rossum.
3. Edit menu is generally created used to edit the file in use.
4. In the interactive mode by Python, the instruction are executed line by line, giving the output.
5. A variable is a named memory location that stores the data.
6. Python keyword cannot be used as a variable name.

B. State True or False:
1. To evaluate an arithmetic expression, it is not necessary to use print() function. (True)
2. A variable name can consist of alphabets, digits, and underscore. (True)
3. A script is a program that you type in Python. (True)
4. In Python, only one type of data can be stored in memory. (False)
Correct Answer:
In Python, more than one type of data can be stored in memory.
5. Print() function is used to accept the value of a variable from the user. (False)
Correct Answer:
Input() function is used to accept the value of a variable from the user.
6. The string values cannot be multiplied together. (True)
7. When we use ‘,’ operator as the separator among the values, the values are displayed with a space between them. (True)

C. Application Based Questions:
1. Kritika’s computer teacher has given her an assignment to display the names of fruits separated with a tab space in Python. Which separator she should use with the print() function?
Answer:
Kritika should use '\t' separator with the print() function.

2. Aman is working on his mathematics project work. He has to perform some quick calculations. Which mode of Python programming should he use for doing the calculations?
Answer:
Aman should use the Interactive mode.

D. Multiple Choice Questions:
1. Which of the following data types is not supported in Python?
a) Numbers
b) String
c) List
Answer:
c) List

2. When a new value is stored in a variable, its previous value gets _________________________.
a) Accepted
b) Overwritten
c) Overlapped
Answer:
b) Overwritten

3. Values to variables are assigned using the _______________ operator.
a) String
b) print()
c) Assignment
Answer:
c) Assignment

4. The data type for 12.4 should be _______________.
a) int
b) float
c) str
Answer:
b) float

5. To give a tab space while printing the statement, we use _______________.
a) \t
b) /t
c) Tab key
Answer:
a) \t

6. The area where we type the code is called ____________________.
a) Work area
b) Worksheet
c) Script area
Answer:
c) Script area

7. >>> print('10'+'20') will give the output _______________.
a) 30
b) 1020
c) 2010
Answer:
b) 1020

E. Answer the following:
1. Write any four features of Python language.
Answer:
Four features of Python language are
• It is an easy to learn general-purpose programming language.
• It has a simple syntax.
• Python is a case sensitive language.
• It is an interpreted language.
• It is free to use and even free for commercial products.

2. What is a variable? Discuss the rules for naming the variables.
Answer:
A variable stores data values. It can store only one data value at a time. When a new value is stored in a variable, its previous value gets overwritten. The rules for valid identifier (variable name) are:
• A variable name must start with an alphabet (capital or small) or an underscore (_).
• A variable name can consist of alphabets, digits, and underscore. No other character is allowed.
• A Python keyword cannot be used as a variable name.
• A variable name can be of any length.
• Variable names are case-sensitive (e.g., Age and age are different variable names).

3. Explain the different working modes of Python.
Answer:
Python works in two modes: Interactive mode and Script mode. In the Interactive mode of Python, the instructions are executed line by line giving the output. Interactive mode is preferred for small programs, where only a few commands are to be executed. This mode is also beneficial for testing code where you type the commands one at a time and get the result or error immediately. Whereas, for writing lengthy programs in Python, Script mode is used. Using this mode, we can create and edit Python programs. In this mode, we can save our file so that it can be used later. The complete script is written in an editor, such as a Notepad in Windows.

4. What are data types? Explain any two data types in Python.
Answer:
A data type represents the type of data stored in a variable. Python has various standard data types based on the types of values stored in variables. Some examples of data types used in Python are, int, float, str.
• Float: Represents floating point values (numbers with fractional part). The fractional part of a floating point number may be 0 as well. Example: 3.14,-48.6, 18.0, etc.
• str (String): String data type represents strings of characters enclosed within quotation marks. Example: 'Ram'.

5. What is the use of print() function? Discuss all the separators used with the print() function.
Answer:
The print() function is used to display the output of any command on the screen. It can also be used to print the specific messages. Separators are used with the print() function to format the output. The separators used in Python are
• Using ',' operator: When you use ',' operator as the separator among the values, the values are displayed with a space between them.
• Using '\t' (tab space): When you use '\t' escape sequence as the separator among the values, the values are displayed with a tab space between them.
• Using '\n' (Newline character): A newline character in Python is used to end a line and start a new line. In Python, the new line character can be used with the input function and with the print function.

6. What is an Interpreter? How is it different from a compiler?
Answer:
Interpreter is a language processor. When you type a command next to the python prompt (>>>) in the interactive mode of Python, and press the Enter key, the interpreter converts the command into machine language. After processing, the interpreter again converts the machine code into human readable form (output). A compiler is also a language processor that converts a program written in high-level language into machine language, and vice versa, just like an interpreter. However, unlike an interpreter, a compiler does this in one single step.


No comments:

Post a Comment

Also read!

Class 6 Solutions

• Class 7

Class 7 Computer Kips Solutions
Class 7 Gul Mohar English Solutions
English Grammar Class 7
English Writing Skills Class 7
Class 7 Map Pointing Solutions
Class 7 NCERT Civics Solutions
Class 7 NCERT Civics Notes
Class 7 NCERT Civics Extra Questions
Class 7 NCERT Geography Solutions
Class 7 NCERT Geography Notes
Class 7 NCERT Geography Extra Questions
Class 7 NCERT History Solutions
Class 7 NCERT History Notes
Class 7 NCERT History Extra Questions
Class 7 NCERT Maths Solutions
Class 7 NCERT Science Solutions
Class 7 NCERT Science Notes
Class 7 NCERT Science Extra Questions

• Class 8

Class 8 Kips Artificial Intelligence Solutions
Class 8 Gul Mohar English Solutions
English Grammar Class 8
English Writing Skills Class 8
Class 8 Map Pointing Solutions
Class 8 NCERT Civics Solutions
Class 8 NCERT Civics Notes
Class 8 NCERT Civics Extra Questions
Class 8 NCERT Geography Solutions
Class 8 NCERT Geography Notes
Class 8 NCERT Geography Extra Questions
Class 8 NCERT History Solutions
Class 8 NCERT History Notes
Class 8 NCERT History Extra Questions
Class 8 NCERT Maths Solutions
Class 8 NCERT Science Solutions
Class 8 NCERT Science Notes
Class 8 NCERT Science Extra Questions
Class 8 NCERT Science Exemplar
Class 8 NCERT Science MCQs

• Class 9

Class 9 Kips Artificial Intelligence Solutions
Class 9 Map Pointing Solutions
Class 9 NCERT Civics Solutions
Class 9 NCERT Geography Solutions
Class 9 NCERT History Solutions
Class 9 NCERT Maths Solutions
Class 9 NCERT Science Solutions

• Class 10

Class 10 Kips Artificial Intelligence Solutions
Class 10 NCERT English Solutions
→ Class 10 Map Pointing Solutions
Class 10 NCERT Civics Solutions
Class 10 NCERT Civics Notes
Class 10 NCERT Civics Extra Questions
Class 10 NCERT Geography Solutions
Class 10 NCERT Geography Notes
Class 10 NCERT Geography Extra Questions
Class 10 NCERT History Solutions
→ Class 10 NCERT History Notes
Class 10 NCERT History Extra Questions
Class 10 NCERT Maths Solutions
Class 10 NCERT Science Solutions
Class 10 NCERT Science Notes
Class 10 NCERT Science Extra Questions

• Computer languages
Python Basics

• Extra Activities
Extra Activities

• Extra Knowledge
Extra Information
General Knowledge
Historical Places in India
Latest technology
Physical Sciences
Facts (Animals)
Facts (Extra)

• Mathematics quick links
Cubes of numbers
Squares of numbers
Mathematical Terms
Maths Tricks