Saturday, 30 December 2023

L-8 Scratch / Class 8th Computer

Class – VIII

Subject: Computer

L-8 Scratch Programming II- Variables, Control, Actions


A.) Fill in the blanks using the words from the help box:

[tempo  , record new sound, commands,   volume,    Boolean block, block, variable ]

 

1)    Scratch provides all types of  commands  as  blocks that can be stacked to form a program or script.

2)    The loudness of a sound is called its  volume, and the speed at which a sound plays is called its tempo.

3)    A  variable  is a placeholder that can hold / store a value as long as your scripts runs.

4)    To record a new sound click on the  record a new sound  button.

5)    The condition is defined via a  Boolean block .

 

B) State ‘T’ for True or ‘F’ False:

1) In scratch, movement of a sprite draws on stage only if pen is down. FALSE

2) A variable is named storage location which holds a value as long as the script runs._TRUE

3) Multiple sprites can receive a message. TRUE

4) You can record a new sound on Scratch. TRUE

5) Green flag is located at the top right corner of the stage._ FALSE

 

C) Multiple Choice Question:

1) Which block menu has the blocks to show or hide a sprite from the stage?

a) Pen

b) Motion

c) Looks

 

Ans: c) Looks

 

2) Which tab is used to add a new sound on the stage.

a) Music

b) Sounds

c) Costumes

 

Ans: b) Sounds

 

3) Which of the following are conditional block.

a) If-else

b) Repeat

c) Forever

 

Ans: a) If-else

 

4) These blocks are repeat, repeat until, forever.

a)  Loop block

b)  Stack block

c)  Selection block

 

Ans: a) Loop block

 

5) The type variable described for only one sprite.

a)  Global

b)  Cloud

c)  Local

 

Ans: c) Local

 

 

d) Answer the following  questions:

 

1) What are variables in scratch?

Ans:  Variables in Scratch are placeholders that store and hold values. They allow the program to remember and manipulate data as the script runs.

 

2) What are the different kinds of variables provided by the scratch? Explain.

Ans:  Scratch provides two main types of variables:

Local Variables: These are specific to a sprite and can only be used by that sprite.

Global Variables: These are shared among all sprites in a project.

 

3) What are Events in scratch? How are these useful.

Ans:  Events in Scratch are actions or occurrences that trigger specific blocks of code. Examples include the green flag clicked, key pressed, or sprite clicked. Events make programs interactive and responsive to user actions.

 

4) Explain the process of adding new sound from the sound library.

Ans:  To add a new sound from the sound library in Scratch, click on the "Choose a Sound" button, then select the desired sound from the library. After selecting, click on the "OK" button to add the sound to the project.

 

5) What is the difference between if and if-else block?

Ans:  The if block checks a condition and executes a set of statements if the condition is true. The if-else block also checks a condition but has an alternative set of statements to execute if the condition is false.

 

6) What is the difference between repeat, repeat until and forever block?

Ans: The repeat block repeats a set of statements for a specified number of times. The repeat until block repeats a set of statements until a specified condition becomes true. The forever block repeats a set of statements indefinitely.

 

Lab Activity:

1)    Open scratch and add any Sprite of your choice on the stage. Create a script and perform the following activities:

a)    Move towards east and then make a circle.

Ans: 1) when green flag clicked

go to x: (-240) y: 0   // Assuming starting point is at the center of the stage

point in direction 90  // Pointing towards east

repeat 36

  move 10 steps

  turn 10 degrees

end

 

b)    Speak something on the stage.

Ans: when green flag clicked

say "Hello, Scratch!" for 2 seconds

 

c)    Add some music in your project.

Ans: when green flag clicked

play sound [your_music.mp3]  // Replace with the name of your music file

 

2)    Draw a flower in scratch.

Ans: when green flag clicked

repeat 36

  // Draw a petal

  forward 50

  right 45

  forward 50

  right 135

  forward 50

  right 45

  forward 50

  // Move to draw the next petal

  right 10

end

 

 

3)    Write a scratch program to draw this.

Ans: when green flag clicked

// Assuming the desired shape is a square

repeat 4

  forward 100

  turn 90 degrees

end

 

Critical thinking:

1)    How to write an interactive program in which a sprite is crazily drawing on stage forever, but if the user presses spacebar, the pen size and the pen color change along with a sound play.

Ans: pen size variable [size]

when green flag clicked

forever

  // Check if space key is pressed

  if key [space v] pressed?

    // Change pen size and color

    set pen size to (size)

    set pen color to [random color]

    // Play sound

    play sound [your_sound.mp3]

  end

  // Crazily draw on stage

  move (10) steps

  turn (15) degrees

  change size by (1)

end

 

2)    Charvi is playing a game created by her teacher using Scratch. The game works like this:

An item/ thing name is shown on screen and then the screen shows moving images of multiple things/ sprites. The player has to click on correct image / sprite as per displayed name. If the player clicks on correct sprite / image, a ball sprite in the right corner starts jumping and clap sound also plays. If the player wants to move to next thing/ item, the player can press a spacebar.

Ans: when green flag clicked

forever

  // Show item/thing name on screen

  say [item_name] for (2) seconds

  // Show moving images of multiple things/sprites

  // (Code logic for displaying moving images)

  // Wait for player's click

  wait until <mouse down?>

  // Check if correct sprite/image is clicked

  if touching [correct_sprite v]?

    // Ball sprite jumps

    repeat (3)

      jump (20) steps

      wait (0.2) seconds

    end

    // Clap sound plays

    play sound [clap.mp3]

  end

  // Wait for spacebar press to move to the next thing/item

  wait until <key [space v] pressed?>

end

 

Group Discussion:

1)    Discuss the different methods to add sounds in a project. Create a loop structure and discuss how to create a pattern and apply sounds while pressing key.

Draw a picture based on the above group discussion.

Ans: Discussion Points:

 

Using the "play sound" block to add sounds.

Utilizing the "when key pressed" event for key interactions.

Creating a loop structure to repeat sound patterns.

Discussing how to synchronize sound with other actions in the project.


Thursday, 7 December 2023

L-7 HTML/CSS Class 8 Computer

Class – VIII

Subject: Computer

L-7 HTML and CSS


A.)  Tick (ü) the correct option:

1)     You can change the look of an entire website by changing just one file:

a)     external style sheet

b)     Internal style sheet

c)     Both a and b

d)     None of these

Ans: c) Both a and b

 

 

2)     Which is the simplest language that can be easily understood and modified.

a)     Java

b)     PHP

c)     HTML

d)     Visual Basic

Ans: c) HTML

 

3)     HTML is platform-

a)     Independent

b)     Dependent

c)     Both a and b

d)     None of these

Ans: a) Independent

 

4)     Which language  allows you  to put styles to customize your web pages.

a)     CSS

b)     JAVA

c)     C

d)     C++

Ans: a) CSS

 

5)     CSS stands for

a)     Cascading style sheet

b)     Cast counting style sheet

c)     Cast common style sheet

d)     Castcading Style sheet

Ans: a) Cascading Style Sheet


B.)   Fill in the blanks using the words from the help box:

[attributes, CSS, Embedded, elements, <link>]

 

1)     HTML allows images and objects to be Embedded  and can be used to create interactive forms.

2)     External styles are defined within the <link>  element, inside the <head> section of an HTML page.

3)     CSS  is considered a very convenient and easy-to-read styling sheet.

4)     Attributes  can be used to change the colour, size, or functionality of HTML elements.

5)     HTML element  can contain formatting instructions, semantic meaning, and content.

 

 

C) Short answer type questions:

1) What do you mean by element?

Ans: An element is a fundamental building block of an HTML document. It consists of a start tag, content, and an end tag. Elements can define various types of content, such as headings, paragraphs, links, images, etc.

 

2)     What do you mean attribute?

Ans: An attribute provides additional information about an HTML element and is always included in the opening tag. Attributes consist of a name and a value and are used to modify or provide additional details about an element.

 

3)     What is internal CSS?

Ans: Internal CSS refers to the style information that is contained within the HTML document itself, typically placed in the <style> element within the <head> section. It allows styling for a specific page.

 

4)     What is External CSS?

Ans: External CSS involves placing the style information in a separate external file with a .css extension. This file is linked to the HTML document using the <link> element, providing a centralized and consistent style for multiple pages.

 

5)     What is inline CSS?

Ans: Inline CSS involves applying styles directly within the HTML tags using the style attribute. It is used for applying unique styles to specific elements on a page.


D) Long answer type questions:

1) What are the advantages and disadvantages of CSS?

Ans: Advantages of CSS include improved site maintenance, consistent styling, faster page loading, and better accessibility. Disadvantages may include browser compatibility issues, learning curve, and potential for increased complexity.

 

2) Write the characteristics of HTML?

Ans: HTML (Hypertext Markup Language) is characterized by being a markup language used for creating the structure of web pages. It consists of elements represented by tags, has a hierarchical structure, supports hyperlinks, and allows the inclusion of multimedia elements.

 

3) Write a short note on

a) Element

Ans: An element in HTML is a fundamental unit consisting of a start tag, content, and an end tag. It defines the structure and content of a document, representing various types of information like text, images, links, etc.

 

b) Attribute

Ans: An attribute in HTML provides additional information about an element and is included within the opening tag. It consists of a name and a value, modifying or enhancing the behavior of the element.

 

c) CSS

Ans: CSS (Cascading Style Sheets) is a styling language used to control the presentation and layout of HTML documents. It allows the separation of content and style, making it easier to manage the visual aspects of a website.

 

4) How we add CSS?

Ans: CSS can be added to HTML documents through three methods: inline, internal, and external. Inline CSS is applied directly within the HTML tags using the style attribute, internal CSS is placed in the <style> element within the <head> section, and external CSS is stored in a separate .css file linked to the HTML document using the <link> element.

 

5) Explain the three ways to add CSS.

Ans: The three ways to add CSS are:

 

Inline CSS: Applied directly within HTML tags using the style attribute.

Internal CSS: Placed in the <style> element within the <head> section of an HTML document.

External CSS: Stored in a separate .css file and linked to the HTML document using the <link> element. This promotes consistency across multiple pages.

 

6) What are the component of CSS?

Ans: The components of CSS include:

 

Selectors: Define which elements the styles should apply to.

Properties: Specify the visual characteristics (e.g., color, size) of the selected elements.

Values: Assign specific values to properties to determine the appearance of elements.

Declarations: Combinations of properties and values.

Rules: Consist of selectors and declarations, defining the styling for selected elements.

Stylesheet: A collection of rules that collectively define the visual presentation of a document.

 


L-1 Indian Heroes in IT/ 8th computer

  Class 8 th Subject : Computer Science L-1 Indian Heroes in IT Make a list of Indian Heroes in IT with their achievement S....