Digital Learning

Monday, January 20, 2025

Computer-Science-Class-8 Chapter-9(2024-25):

Computer Science
Class-8
Chapter-9 Taming Python

A. Tick the correct answer:
1. Python is a ______________ language:
a. Dynamically            b. Case sensitive            c. Compiler based        d. Both a and b.
Answer: Dynamically
2. len("hello world") will return ____________ as output.
a. 10                                b. 11                                c. 9                                    d. 5
Answer: 10

B. Fill in the blanks:
1. ______________ are non executable statements in a program.
Answer: Comments
2. Python commands are executed without saving in _____________ mode.
Answer: Interactive
3. __________ operator is also known as floor division.
Answer: //

C. Tick the T for true or F for false:
1. Python is platform dependent.
Answer: F
2. Datatype of the output returned for 4/2 and 4//2 will be same.
Answer: F
3. Identifier is the label given on the memory location for reference.
Answer: T


D. Answer the following questions:
1. List any three applications of Python programming language.
Answer: Python is a programming language with many applications, including:
*Data Science: Python is used to collect, analyze, and visualize data. 
* Software development: Python is used in all stages of software development, including building, testing, and maintenance.
* Machine learning and artificial intelligence: Python is used in machine learning and artificial intelligence.
* Web development: Python is used to build web apps.
* Game development: Python is used to develop games.

2. Give an example of single line as well as multi line comment.
Answer: 
Single line comments: Single line comments begin with the "#" character.
Example: 
1. # defining general structure of a car
2. car={
3. "Car_Id": 0, #car reference id, default:0
4. "Car_Description": "", #general description, default:empty
5. "Car_CategoryId": 0, #car category, default: 0
6. "Car_Price": 0, #car's price, default: 0.00
7. }
8. print (car)

Multi line comments:
Example:
1. # You can use
2. # multi-line comments
3. # in this way by
4. # including the comment character
5. # at the beginning of each line

3. Give one advantage for each script mode as well as interactive mode.
Answer: Script mode is useful when you want to run a series of commands on a file or group of files, while the interactive mode is better for testing out individual commands.

No comments:

Post a Comment