0% found this document useful (0 votes)
91 views

Comsats Institute of Information Technology: Lab Manual Introduction To Information & Communication Technologies

This document provides instructions for a lab manual on introductory programming concepts using Scratch. It includes two main tasks - the first focuses on practicing loops and conditional statements, while the second task involves math operations and variables. For each task, students are given example problems to solve that apply the relevant programming concepts. The document also includes discussion questions to test understanding of loops, variables, and conditionals in Scratch.

Uploaded by

mehreen attia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

Comsats Institute of Information Technology: Lab Manual Introduction To Information & Communication Technologies

This document provides instructions for a lab manual on introductory programming concepts using Scratch. It includes two main tasks - the first focuses on practicing loops and conditional statements, while the second task involves math operations and variables. For each task, students are given example problems to solve that apply the relevant programming concepts. The document also includes discussion questions to test understanding of loops, variables, and conditionals in Scratch.

Uploaded by

mehreen attia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

| Zaheer Ahmad

Comsats Institute of Information Technology

Lab Manual
Introduction to Information & Communication Technologies

Course Instructor Zaheer Ahmad

Lab Instructor(s) Zaheer Ahmad

Class-Section

Semester

1|Page
| Zaheer Ahmad

Table of Contents
Objectives ....................................................................................................................... 3
Task List ........................................................................................................................... 3
Task-1 Practicing with loops & Conditions .............................................................................. 3
Problem #1-Name Animation .......................................................................................... 3
Problem #2-Embedded Loop ........................................................................................... 3
Problem #4-Repeat Until ............................................................................................... 3
Problem #5-Loop & Conditional ....................................................................................... 3
Question #2-No end in sight ........................................................................................... 4
Question #3-Forever Loops ............................................................................................. 4
Question #4-Sprite Communication ................................................................................... 4
Question #5-Conditionals ............................................................................................... 4
Task-2 Practicing Math & Variables ...................................................................................... 4
Problem #1-Quick Costume Change .................................................................................. 4
Problem #2-A.I ........................................................................................................... 4
Problem #3-Distance Formula ......................................................................................... 5
Problem #4-Pump up the volume ..................................................................................... 5
Problem #5-Metric Converter .......................................................................................... 5
Question #1 ............................................................................................................... 5
Question #2 .............................................................................................................. 5
Question #3 .............................................................................................................. 5
Question #4 .............................................................................................................. 5
Question #5 .............................................................................................................. 5

2|Page
| Zaheer Ahmad

Week-04
Objectives
After performing this lab, students shall be able to:
▪ Get familiar with the scratch environment
▪ Implement basic sequencing, branching and iterations in scratch

Task List
Task-1 Practicing with loops & Conditions
Create a word report for this manual.

Open Website: http://scratch.mit.edu/

Problem #1-Name Animation


Create your own sprite that contains your name. You need to animate it using multiple costumes.

Problem #2-Embedded Loop


Try the following loop structures. Which will result in the sprite moving 100 steps? Think about WHY this is
happening.

Problem #4-Repeat Until


Create an animation containing two sprites. The first sprite should animate until a given event (i.e. touching the
edge, touching a sprite, a key is pressed…). After the event occurs, the first sprite should broadcast a message
that triggers the animation for the second sprite. For added difficulty have the sprites only show up during their
animation, have the stage change and have some music play

Problem #5-Loop & Conditional


Using any sprite you’d like, run the following code. Which seems to work the best? Why?

3|Page
| Zaheer Ahmad

Question #1-Loops

What are the types of loops contained in Scratch? What are the
differences?

Question #2-No end in sight


If you are given a situation where you want an action to repeat, but you
don’t know how long it should repeat for, which loop is the best
structure to use? Why?

Question #3-Forever Loops


Does the following loop structure work? Does it make sense? Why or
why not?

Question #4-Sprite Communication

How can sprites “know” when to begin an action? Is there more than
one way?

Question #5-Conditionals

Are the following code snippets equivalent? Why or why not?

Task-2 Practicing Math & Variables

Problem #1-Quick Costume Change


Create a simple animation using the built in costumes for any sprite you choose. You should use a forever loop
so that the animation won’t end. Add another sprite to act as a button. Name this sprite “Faster”. Add another
sprite that also acts as a button. Name this sprite “Slower”. Using a variable called “speed”, have the faster
button speed up the animation and the slower button slow it down.

Problem #2-A.I.
Build a program where a sprite asks for the following information (the answers should all be stored as variables)
• Name
• Grade
• Favorite Activity

4|Page
` | Zaheer Ahmad

• Favorite Food
The sprite should then have a ‘conversation’ with another sprite (who wasn’t on the screen until now) about the
cool person they just met.

Problem #3-Distance Formula


Write a program that takes two ordered pairs of points and calculates the distance between them. Hint: You
might want to use 4 variables. Test your program with a known distance. For example, the ordered pairs (2, 3)
and (5, 7) should have a distance of 5 units.

Problem #4-Pump up the volume


Create a dance party where at least three sprites are dancing. There should be music in the background. Add a
sprite that controls the volume of the music. If the music gets too loud, determined by you, the police should
come and everyone run off the screen. Note, you will need a conditional (if statement) in a forever loop to
determine if the volume is too high
Problem #5-Metric Converter
Create a program that takes a measurement in feet and inches and converts it to metric units of mm, m and
km. You should have at least 5 variables (you might want 6). The sprite should ask the user for both feet and
inches and store these values as separate variables. Then after performing some calculations, the values for
mm, m and km should be ‘set to’ to appropriate values. You should check your numbers to make sure your
output is correct.
Question #1
Are variables in computer programming the same as variables in math class? Why or why not?
Question #2
When creating a variable, what are the two types of scope a variable can have? That is, what can it
affect. (Think about your options as you make a variable)
Question #3
How many values can a variable store at one time?
Question #4
What will the following code snippet do? Explain why it doesn’t work as intended.

Question #5
Given the following code snippet, explain what is happening.

5|Page

You might also like