0% found this document useful (0 votes)
26 views10 pages

Week 1

Uploaded by

riyaranirr2
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)
26 views10 pages

Week 1

Uploaded by

riyaranirr2
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
You are on page 1/ 10

The Joy of programming using Python

Rupesh Kumar
Friday, July 26 2024
6-8 PM

1. Which of the following best defines a variable in programming?


a. A constant value that cannot be changed during program execution.
b. A named storage location that can hold varying data during program
execution.
c. An operation that performs arithmetic calculations on data.
d. A reserved word is used to define a function or method in a program.
Answer: Option b

2. Humans easily get bored doing a repetitive job. However, computers are masters of
iteration. In programming, we get a control structure that allows a set of instructions
to be executed repeatedly based on a condition. It enables automating repetitive tasks
by iterating through a block of code until a specific condition is met or for a defined
number of times. What is this control structure called?
a. Variable
b. Operator
c. Loop
d. Data Type
Answer: Option c Loop

3. Programming logic is different from programming language. Programming languages


are many, but programming logic almost remains the same across all programming
languages. Which of the following is programming logic?
a. Python
b. C
c. C++
d. None of the above
Answer: Option d, all the above are programming languages.

4. Open-source software, unlike proprietary software, is computer software developed


through public, collaborative efforts and made freely available to the public. Which of
the following programming languages is/are open source?
a. Java
b. Python
c. FORTRAN
d. Perl
Answer: All of the above

5. Knowing how to write a piece of code could help us get things done fast. Choose the
areas where we can implement coding.?
a. Physics
b. Mathematics
c. Economics
d. Small Scale Business
Answer: All of the above.
Problem Introduction:

6. The provided image depicts a scene from a presentation featuring The Famous Cat at
Scratch attempting to play football with a Boomerang ball disguised as a volleyball.
The unexpected return of the ball leads to a humorous outcome.

Accompanying is the set of code blocks that achieve what is stated above [Not
necessarily in sequence of execution]. Answer the questions that follow:
The block of code displayed here is meant for the cat, what is the functionality of this code?

a. It brings the ball closer to the cat.


b. It makes the cat appear like kicking the ball.
c. It makes the cat tumble and rotate
d. The code throws an error.
Answer: Option b, it makes the cat appear like kicking the ball.
7. The block of code displayed here makes the cat rotate out of impact from the
boomeranging ball, how many complete rotations does the cat make?

a. One
b. Two
c. Three
d. Four
Answer: The Cat makes three complete rotations. Total 4 rotations by 90 degrees
are required for a complete rotation. The outer repeat statement is running the
inside block 3 times and the inner repeat statement is running the rotation
instruction 4 times. So, the cat is being rotated 12 times by 90 degrees.
8. The block of code displayed here makes the cat rotate out of impact from the
boomeranging ball, how many loops are there in total?

a. One
b. Two
c. Three
d. Four
Answer: Option b.

9. The block of code displayed here is meant for the ball, how many loops are there in
total?
a. One
b. Two
c. Three
d. Four
Answer: One loop, Option a.

10. The block of code displayed here is meant for the ball, if the value beside repeat
would have been 1 instead of 2, Select all the statements that explain the situation.
a. The Ball would not have returned to Cat.
b. Removing the loop from the code would have made no difference in the result.
c. The Ball would not have left its original position.
d. The code would throw an error
Answer: Option a. The ball would not have returned to the Cat.

Programming Problems
Write a program to tell the user if they are eligible for voting.
User is elgigible for voting if their age is > 18.
Age
Set Age
If(Age > 18)
Eligible
Else
Not eligible

Write a program to give pass or fail grade to a student based on the obtained
marks. (Passing marks is 40).

Write an instruction block in scratch to compute sum of integers from 1 to 10.

You might also like