Saturday, October 5, 2024

Introduction to Scratch and Key Features of Scratch

 


Introduction to Scratch

v Scratch is a visual programming language created by MIT for children and beginners to learn the basics of programming.

v It allows users to create interactive stories, games, and animations using a simple drag-and-drop interface, without needing to write code.

v Scratch can be used both online (in a web browser) and offline (with the Scratch Desktop app), so users can learn and create projects anywhere, even without internet access.

v Scratch is widely used in educational environments because it makes learning to code easy and fun.

 

Key Features of Scratch

v  Drag-and-Drop Interface: Users can drag and connect blocks instead of writing code.

v  Color-Coded Blocks: Blocks are color-coded based on their function (e.g., Motion, Control, Events), making it easy to understand and use them.

v  Multimedia Integration: Users can add sounds, images, and animations from Scratch's library or create their own.

v  Interactive Learning and Storytelling: Users can create games and animations while learning by exploring and experimenting with their projects.

v  Community and Collaboration: Scratch has an online community where users can share and remix projects, encouraging creativity and teamwork.

v  Beginner-Friendly: Scratch does not require writing code, making it perfect for children and beginners to learn programming in a fun way.

3.1 Concept of Block Programming

 



3. Block Programming

3.1 Concept of Block Programming

 

Block programming is a visual method of coding where programs are created by arranging blocks instead of typing text.

Each block represents a specific command or action, making it easier for beginners to learn programming without worrying about complex code syntax.

The blocks are designed to fit together like puzzle pieces, making it easy to understand the logic of the program.

 

Key Features:

v Visual Interface: Programs are created by dragging and connecting graphical blocks, rather than writing lines of code.

v No Syntax Errors: The blocks snap together in specific ways, reducing errors common in text-based coding.

v Focus on Logic: Emphasizes the logic of programming without worrying about the technicalities of language syntax.

v Color-Coded Blocks: Different types of blocks have different colors for easy identification.

 

Purpose:

Block programming is mainly used for educational purposes to help beginners, especially children, learn to code by simplifying complex programming concepts and making them more engaging and interactive. It provides a foundation for understanding programming logic and problem-solving that can be applied to more advanced, text-based programming languages later on.

 

Examples of Block Programming Tools:

v  Scratch: A popular tool for creating animations, stories, and games.

v  Blockly: A web-based library for building block programming environments.

v  MIT App Inventor: Used for developing mobile apps using blocks.

 

Benefits of Block Programming

v  Beginner-Friendly: Designed to help new learners focus on logic, not syntax.

v  Interactive Learning: Immediate feedback makes learning fun.

v  Reduces Errors: Blocks snap together in the right way, preventing syntax mistakes.

 

Why Block Programming is Important?

v  Accessible to All: Kids and beginners can learn to code easily.

v  Foundation for Future Learning: Prepares learners to understand programming logic before moving to text-based languages.

v  Engages Creativity: Encourages building games, stories, and creative projects.

 

Summary

v  Block programming makes coding easy and fun.

v  It uses visual blocks, making it ideal for beginners.

v  Tools like Scratch and Blockly make programming accessible to everyone.


Friday, October 4, 2024

SOLVED PABSON Kathmandu MID TERMINAL EXAMINATION-2081 Subject: Opt. II Computer Science

 

2081-06-18

SOLVED

PABSON Kathmandu

MID TERMINAL EXAMINATION-2081

Subject: Opt. II Computer Science                                                                                     Full Marks: 50

Class: 10                                                                                                                                 Time: 2 hrs.

 

Candidates are required to answer the questions in their own way words as far as practicable. Figures in the margin indicate the full marks.

 

Attempt all questions.

 

Group 'A'(10 Marks)

 

1. Answer the following questions in one sentence: (6x1=6)

 

a) What is LAN?

Ans: LAN (Local Area Network) is a network that connects computers within a limited area such as a home, school, or office building.

 

b) Give any two examples of AI.

Ans: Two examples of AI are voice assistants (e.g., Siri, Alexa) and self-driving cars.

 

c) What is data redundancy?

Ans: Data redundancy is the duplication of data within a database.

 

d) What is the purpose of a table?

Ans: The purpose of a table is to organize and store data systematically in rows and columns.

 

e) What is global variable in QBASIC?

Ans: A global variable in QBASIC is a variable that can be accessed and modified from any part of the program.

 

f) What is looping?

Ans: Looping is the process of repeating a set of instructions until a specified condition is met.

 

2. Write appropriate technical term for the following:                                                    (2×1=2)

 

a) Digital marks created while using internet. Digital footprint

b) Making duplicate copy of file for security purpose. Backup

 

3. Write the full form of the following:                                                                              (2×1=2)

 

a) GIF - Graphics Interchange Format

b) NIC - Network Interface Card

 

Group 'B' (24 Marks)

 

4. Answer the following questions:                                                                                     (9×2=18) mail.

 

a) Give any two advantages of e-mail over traditional mail.

Ans: Two advantages of email over traditional mail are faster delivery and the ability to send multimedia attachments (such as images and documents) instantly.

b) Write any two advantages and disadvantages of social media.

Ans: Advantages of social media:

  • Facilitates easy communication and networking with people worldwide.
  • Provides a platform for sharing information and promoting businesses.

Disadvantages of social media:

  • Can lead to privacy issues and data breaches.
  • May cause addiction and negatively impact mental health.

 

c) What do you mean by software security? Write any two methods to protect the computer software.

Ans: Software security refers to measures taken to protect software from unauthorized access, vulnerabilities, and malicious attacks.

Two methods to protect computer software:

  • Use strong passwords.
  • Install and regularly update antivirus software.

 

d) Write any two advantages and disadvantages of online payment.

Ans: Advantages of online payment:

  • It is fast and convenient, allowing payments to be made instantly from anywhere.
  • It provides easy record-keeping and transaction history.

Disadvantages of online payment:

  • It can be easily targeted by hackers and used for fraud.
  • It requires a reliable internet connection, which may not always be available.

 

e) Define virtual reality. Write any two areas where VR is used.

Ans: Virtual reality (VR) is a computer-generated simulation that immerses users in a three-dimensional, interactive environment.

Two areas where VR is used:

·       Gaming and entertainment.

·       Medical training and therapy.

 

f) What is database? Give any two examples of it.

Ans: A database is an organized collection of data that is stored and managed for easy access, retrieval, and updating.

Two examples of databases: Dictionary and Marks Ledger

 

g) What is validation rule and validation text?

Ans: Validation rule is a condition set on data entry fields to ensure that the entered data meets specific criteria.

Validation text is the message displayed to users when the data they enter does not meet the validation rule.

 

h) What is a query? What is the purpose of query in MS-Access?

Ans: A query is a request to extract specific information from a database.

The purpose of a query is to retrieve, filter, and manipulate data from one or more tables to meet specific requirements, allowing users to easily analyze and make decisions based on that data.

 

i) What is report in MS-Access? Why it is important?

Ans: A report in MS-Access is a formatted document that presents data from the database, allowing users to view, summarize, and print information in an organized way.

Reports are important because they help present data in a structured way, making it easier to analyze, share, and make informed decisions.

 

 

5. Write down the output of the given program. (Show with dry run in table).             (2)

 

DECLARE SUB Show (XY$)

CLS

XY$ = "HTUOMENXSA"

CALL Show(XY$)

END

 

SUB Show(XY$)

A = 47

FOR I = 1 TO 5

    N = A MOD 7

    PRINT MID$(XY$, N, 1)

    A = A - 1

NEXT I

END SUB

 

Dry Run in Table:

XY$

A

I = 1 TO 5

N =A MOD 7

PRINT MID$(XY$, N, 1)

A = A - 1

HTUOMENXSA

47

1 to 5 yes

47 MOD 7 = 5

M

46

 

46

2 to 5 yes

46 MOD 7 = 4

O

45

 

45

3 to 5 yes

45 MOD 7 = 3

U

44

 

44

4 to 5 yes

44 MOD 7 = 2

T

43

 

43

5 to 5 yes

43 MOD 7 = 1

H

42

 

42

6 to 5 no

Loop exits

 

 

 

 

The output of the program is:

M

O

U

T

H

 

6. Re-write the given program after correcting the bugs: (2)

REM to display greatest number

DECLARE GREAT FUNCTION (a, b, c)

ACCEPT a, b, c

PRINT GREAT (x, y, z)

END

 

FUNCTION GREAT (a, b, c)

IF a>b or a>c THEN

G=a

ELSEIF b>a AND b>c THEN

G=b

ELSE

G=c

NEXT

G=GREAT

END SUB

Debugged Program

 

REM to display greatest number

DECLARE GREAT FUNCTION (a, b, c)

INPUT a, b, c

PRINT GREAT (a,b,c)

END

 

FUNCTION GREAT (a, b, c)

IF a>b AND a>c THEN

G=a

ELSEIF b>a AND b>c THEN

G=b

ELSE

G=c

END IF

GREAT=G

END SUB

 

 

7. Study the following program and answer the given questions:                                   (2x1=2)

 

REM “to count vowels”

DECLARE FUNCTION count (A$)

INPUT "Enter a word"; A$

 

End

 

FUNCTION count (A$)

B=LEN (A$)

C$=UCASE$(A$)

FOR I=1 to B

E$=MID$(C$, I, 1)

IF E$="A" or E$= "E" or E$= "I" or E$="O" or E$ = "U" THEN

C=C+1

END IF

NEXT I

Count=C

END FUNCTION

 

Questions:

 

a) List the string library functions used in the above program.

Ans: The string library functions used in the above program Re LEN ( ), UCASE$( ), MID$( )

b) Write down the missing execute the program. statements in the main module to execute the program.

Ans: PRINT count(A$) is missing execute the program. statements in the main module to execute the program.

 

 

 

 

 

Group C (16 Marks)

 

8. Convert/Calculate as per the instruction: (1x44)

 

i) (231)8  =  (x)10

(2 × 8²) + (3 × 8¹) + (1 × 8⁰)

(2 × 64) + (3 × 8) + (1 × 1)

(128) + (24) + (1)

= 153

(231)8  =  (153)10

 

ii) (1D3)16  = (?)2

Convert each hex digit to 4 binary digits (see conversion table below):

1D3

= 1 D 3

1 = 0001

D = 1101

3 = 0011

 

(1D3)16  = (111010011)2

 

 

ⅲ) (111001-11) + 111001

 

 

 

 

1

1

1

0

0

1

 

 

 

 

 

 

 

-

1

1-

 

 

 

 

1

1

0

1

1

0

 

 

 

+

1

1

1

0

0

1

 

 

 

1

1

0

1

1

1

1

 

(111001-11) + 111001 = 1101111

 

iv) (101101 ¸ 110)

110)

1

0

1

1

0

1

(111

 

 

1

1

0

 

 

 

 

 

1

0

1

0

 

 

 

 

 

1

1

0

 

 

 

 

 

1

0

0

1

 

 

 

 

 

1

1

0

 

 

 

 

 

 

1

1

 

 

Q=111

R=11

 

9. Answer the following                                                                                                        (4x2=8)

 

a) WAP that asks principal, time and rate of interest and calculate simple interest using SUB.... END SUB and amount using FUNCTION.... END FUNCTION. [Hint: SI=P*T*R/100, Amount=P+SI]

 

DECLARE SUB CSI (P, T, R, SI)

DECLARE FUNCTION AMT (P, SI)

CLS

 

INPUT "Enter Principal: "; P

INPUT "Enter Time (in years): "; T

INPUT "Enter Rate of Interest: "; R

 

CALL CSI(P, T, R, SI)

A = AMT(P, SI)

PRINT "Simple Interest: "; SI

PRINT "Total Amount: "; A

END

 

SUB CSI (P, T, R, SI)

    SI = P * T * R / 100

END SUB

 

FUNCTION AMT (P, SI)

    AMT = P + SI

END FUNCTION

 

b Write a program to check whether a string is palindrome or not using SUB...END SUB

 

DECLARE SUB REV (S$)

CLS

INPUT "ENTER ANY STRING"; S$

CALL REV(S$)

END

 

SUB REV (S$)

FOR I = LEN(S$) TO 1 STEP -1

B$ = MID$(S$, I, 1)

W$ = W$ + B$

NEXT I

IF S$ = W$ THEN

PRINT  “THE GIVEN STRING IS PALINDROME”

ELSE

PRINT “THE GIVEN STRING IS NOT PALINDROME”

END IF

END SUB

 

 

10. Write a program to ask number and check it is exactly divisible by 4 and 6 using SUB......END SUB.

DECLARE SUB CHECK (N)

CLS

INPUT “ENTER ANY NUMBER”; N

CALL CHECK (N)

END

 

SUB CHECK (N)

IF N MOD 4 = 0 AND N MOD 6 = 0 THEN

PRINT “THE GIVEN NUMBER IS COMPLETELY DIVISIBLE BY 4 AND 6”

ELSE

PRINT THE GIVEN NUMBER IS NOT COMPLETELY DIVISIBLE BY 4 AND 6”

END IF

END SUB

 

or

 

Write a program in QBASIC to display sum of first 10 natural numbers using FUNCTION.... END FUNCTION.

 

DECLARE FUNCTION SUM( )

CLS
PRINT “Sum of first 10 natural numbers is”; SUM

END

FUNCTION SUM( )

S=0

FOR I = 1 TO 10

S = S + I

NEXT I

SUM = S

END FUNCTION