COMPUTER Lesson -1 to 4


Answers of textbook exercises 

Fill in the Blanks 

1. You can create g a m e s using Visual Coding. 

2. Paint option can be used to draw a S p r i t e

3. To view all the backdrops in your project, select the current backdrop, then go to the B a c k d r o p s tab. 

4. We use l o o p s for repeated tasks in programming. 5. Loops can be used to draw p a t t e r n s

State True or False 

1. We can't develop games having more than one level using Visual Programming. -False 

2. A Sprite can have more than one costume in Visual Coding. -True 3. We can create two costumes for a sprite in two different positions.-True 

4. We can not add different backdrops for different levels of the game. -False 

5. Variables are containers to store data. -True

Match the Following 


1. Variable

2. Move sprite 3. Change costume

4. Draw

5. Loop



Multiple choice questions 

1. Which icon below can be used to draw the rectangles in the Costumes window.

ans.d 

2. To create a variable, click on: 

ans.b 

3. Which of the following is a loop in visual coding? 

d. All of these 

4. Which block below can be used to change the backdrop? ans.a 

5. Visual Coding can be used to create: 

a. Games

b. Patterns 

c. Both a and b 

d. None of the above 

Answer in one word or one sentence 

1. How can you colour a rectangle in a Costumes window? You can choose the colour from the “Fill” and “Outline” options at the top. 

2. What is the use of the “erase all” block? 

The block removes all the marks made on the stage, by the pen. 

3. How can you duplicate a sprite’s costume? 

Right click on costume and choose the option for the duplicate from the pop up menu. 

4. Name the block used to change the costume of a sprite. Switch costume to0 _. 

5. What is the use of a loop in programming? 

Loops are used for repeating tasks in programming. 

Answer the following 

1. Write the steps to draw a sprite in Visual Coding. Click on the Paint option from the Choose a Sprite menu. Draw the Sprite in the costume window that appears. 

2. How can you add more backdrops in Visual Coding? To add multiple backdrops, select the "Choose a Backdrop" option, pick the desired backdrop from the library or create

your own, then repeat the process to add more backdrops as needed. 

3. How can you create a variable in Visual Coding? 

We can create a variable in Visual Coding using Make a variable button from Variables block category. 

4. Write down any four blocks under Motion category move_steps 

turn_degrees 

point in direction 

set x to 

5. Explain the steps to create a variable in Visual coding. Click on Variables on the code palette. 

Click on "Make a variable" button to create a new variable.

LESSON_-2


Answers of textbook exercises 

Fill in the Blanks 

1. Current major version of python is 3

2. Python is created by G u i d o R o s s u m 

3. I D L E is an editor for Python. 

4. I n d e n t a t i o n is used for identifying blocks of code in Python. 

5. Command p y t h o n - V is used to find the version of Python installed. 

State True or False 

1. Python is case sensitive. -True 

2. Python supports only Object Oriented programming. -False 3. Single quotes (') and double quotes (") are valid ways to delimit a string value in Python. -True 

4. Python is a high level language. -True 

5. An integer value cannot be negative. -False 

Match the Following

1. Interpreter 

Execute program

2. x=10 

Statement

3. ** 

Exponent

4. Variable 

Value



5. IDLE 

Editor



Multiple choice questions 

1. In Python // operator is used for: 

a. Multiplication 

b. Division 

c. Floor division 

d. Subtraction 

2. Python is: 

a. Interpreted 

b. Compiled 

c. Both interpreted and compiled 

d. None of the above 

3. Python supports: 

a. Procedural programming 

b. Object oriented programming 

c. Both of the above 

d. None of the above 

4. Command to find version of Python is: 

a. python -V 

b. version - Python 

c. which - version 

d. Python version 

5. Python is: 

a. Interactive 

b. Highly readable 

c. Easy to learn 

d. All of the above

Answer in one word or one sentence 

1. What is the operator used for changing the value of a variable? Assignment operator ( = ). 

2. What is a logical instruction that the Python interpreter can read and execute called? 

Statement. 

3. What is used as a placeholder for the string values that you want to inject into a formatted string? 

%s 

4. What is the use of the ** operator in Python? 

To find the exponent. 

5. Which module of Python gives methods related to Operating Systems? 

Python OS module. 

Answer the following 

1. What are the features of Python? 

It is easy to learn, readable and portable. Python has a standard library which is very portable and cross-platform compatible and supports interactive Mode. Python provides interface to all major commercial databases. 

2. How will you print your name in Python? 

To Print your name in Python, you can use the print statement along with your name enclosed in quotation marks. 

For example: print("Your Name")

3. Python is said to be portable. Why? 

Python can run on a wide variety of hardware platforms and has the same interface on all platforms. If a Python script is written on one system, such as Windows, it can be executed on another, like Mac, without substantial modifications. 

4. What are the rules for naming variables in Python? - Must start with a letter or underscore (_). 

- May consist of letters, numbers, and underscores. 

- Variable names are Case Sensitive. 

5. Name five reserved keywords in Python. 

- if 

- while 

- continue 

- break 

- for

LESSON_-3

Answers of textbook exercises 

Fill in the Blanks 

1. T r i p l e q u o t e s is used for multiline comments in Python. 

2. l e n ( ) method is used to find the length of a string in Python. 3. We use i n p u t ( ) command to get data from the user. 4. A Dictionary is also known as a s s o c i a t i v e a r r a y 5. If we multiply an integer with float, datatype of the result will be f l o a t

State True or False 

1. Comments are executed by the Python interpreter. -False 2. A Python list can have elements of different data types. -True 3. When you multiply an integer with float, the result will be implicitly converted to float. -True 

4. A dictionary is an associative array. -True 

5. A tuple is a sequence of immutable Python objects. -True Match the Following

1. Lists 

[]



2. Type Conversion 

float(var_name)

3. Comment 

“ “ “

4. Dictionary 

{}

5. Complex 

27.8j



Multiple choice questions 

1. Which of the following is not a basic data type in Python? a. Lists 

b. Dictionary 

c. Tuples 

d. Class 

2. What is the data type of the object given below ? obj = [100, “Cybersquare”, ‘baabtra’, 123] a. List 

b. Array 

c. Tuple 

d. Dictionary 

3. How can you convert a string variable x to a float in Python? a. int(x[,basel) 

b. long(x [,base]) 

c. float(x) 

d. str(x) 

4. What is the output of the following program? 

X = {1:1, 2: 2, ‘1’:‘one’, ‘2’:‘two'} 

print(X['1’]) 

a. 2 

b. 3

c. one 

d. 1 

5. Which of the following types is not supported by Python? a. int 

b. Double 

c. float 

d. complex 

Answer in one word or one sentence 

1. What is the output of the program below? name = “Cybersquare” 

“Hello” + name[5:] 

Hellosquare 

2. What is the output of the program below? name = “Cybersquare” 

“Hello” + name [:5] 

HelloCyber 

3. What is the output of the program below? dict1 = {1:'one’, 2:'two’, ‘1’:1, '2': 2} list1=[1, 2, 3, 4, 5] 

print(dict1[list1[-4]]) 

two 

4. What is the output of the program below? sentence = “i am studying cybersquare” print (sentence. upper())

I AM STUDYING CYBER SQUARE 

5. What is the output of the program below? 

a=10 

b=20 

sum=int(str(a) + str(b)) 

print(sum) 

1020 

Answer the following 

1. What are the uses of comments in a computer program? A comment is a human-readable description in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand. 

2. What are the differences between a Tuple and a List? Tuples use parentheses () for declaration, and their elements cannot be changed after creation, whereas lists use square brackets [] and allow for modifications to their elements. 

3. Write a program to input your name and print “Hello your name". 

name = input("Enter your name: ") 

print("Hello", name) 

4. Write a program to input two numbers and display the sum. num1 = float(input("Enter the first number: "))

num2 = float(input("Enter the second number: ")) print(num1+num2) 

5. Create a dictionary with your roll number, first name, last name, date of birth and gender. 

my_dict = { 

"roll_number": "21", 

"first_name": "first name", 

"last_name": "last name", 

"date_of_birth": "2000-01-01", 

"gender": "Male" 

}

LESSON_-4

Answers of textbook exercises 

Fill in the Blanks 

1. If num=10, value of num==10 is T R U E 

2. I f statement is used in Python for decision making. 3. When an if is placed inside another if statement, it is called n e s t e d i f 

4. elif is the short form of e l s e i f

5. There can be an o p t i o n a l else block with an if block. 

State True or False 

1. Computer can make decisions on their own. -False 

2. The code inside an if block is executed always . -False 3. You cannot place another if block inside an if block. -False 4. The code inside an if block is executed when the condition given is true. -True 

5. Checking multiple conditions in Python requires elif statements. -True 

Match the Following

1. if 

Executes when the condition is True



2. else 

Executes when the condition is False

3. 25<22 

FALSE

4. “abc”==”abc” 

TRUE

5. Block of code 

indentation



Multiple choice questions 

1. Which of the following is not a keyword in Python? 

a. if 

b. elif 

c. else 

d. Else if 

2. Python interprets positive numbers as : 

a. True 

b. False 

c. None 

d. None of the above 

(when a numerical value is used in a boolean context, it is treated as True if the value is non-zero, and False if the value is zero. 

Positive numbers are non-zero, so they are considered as True in boolean expressions.) 

3. What is the output of the program below? 

If None : 

print (“Hello”) 

a. Hello 

b. Nothing will be printed. 

c. None 

d. None of the above

(In Python, None is considered as False in boolean expressions. Since None is considered False, the condition in the if statement is False, and the code block inside the if statement will not be executed. Therefore, the output of this program will be nothing; it won't print "Hello.") 

4. For checking multiple conditions we use : 

a. If block only 

b. If… else 

c.If…elif…else 

d. None of the above 

5. else block is executed when the condition is : 

a. True 

b. False 

c. never 

d. None of the above 

Answer in one word or one sentence 

1. What is the purpose of an if statement in Python? It is used for decision-making. 

2. What is a “nested if” statement in Python? 

Nested if statements refer to an if statement inside another if statement. 

3. The code inside an if statement is executed when the condition is : 

TRUE 

4. The output of a test expression given inside an if statement will be: 

Boolean(True or False)

5. Python interprets None as : 

FALSE 

Answer the following 

1. Write down the syntax of if statement in Python. 

if condition: 

Code to be executed if the condition is true. 

2. What Is the use of elif in Python? 

The elif(short form of else if) statement allows to check multiple conditions and execute a particular block of code. 

3. Draw the flowchart of an if . . . elif . . . else ladder?

4. What is the difference between a ‘nested if’ and if . . . elif ladder?

A nested if is placing one or more 'if' statements inside another, Whereas if...elif...else ladder is a sequence of conditions where each elif (else if) block is evaluated only if the preceding if or elif condition is False. 

5. Write a program to input a number. Find out whether it is greater than or less than 100. 

num = int(input("Enter a number: ")) 

if num > 100: 

print("The number is greater than 100") 

else: 

print("The number is less than 100")








Comments