UNIT NO.5
Programming
(Solved Exercise)
Briefly answer the following questions:
1. What is the function of a program?
2. What is a programming language?
Programs are written in programming languages. These programming languages provide us the facility to write programs in text base editors or in visual mode. The languages that are easily understandable by computer are known as low level languages whereas the languages that are near to human languages are called high level languages. High level languages need to be translated into low level language so that the computer can understand them. Programming language can be categorized an under:
1. Machine language/low level language
2. Assembly languages/intermidiary language
3. High-level languages a
3. Briefly explain three types of programming language. Also explain the difference between them.
Machine Language
This low level language, machine language, represents data and program instructions as 1s and binary digits corresponding to the on and off electrical states in the computer. Each type of computer has its own machine language.
Assembly Language
Assembly language is considered intermediate that is, they are not as easy for people to use as more recent languages. Assembly languages permit the use of names for memory locations instead of actual address numbers. Just like machine language, each type of computer has its own assembly language.
High-Level Languages
Programs are written in an English-like manner, which make them more easy to use. As a result, a programmer can develop more programs with less effort, and programs could now solve much more complex tasks. A translator such as computer is needed to translate high level language into machine language.
4. What is Scratch?
Scratch is a programming software that makes it easy for us to create interactive games, animation and stories. When scratch opens, it displays a single character by default that is called sprite. We can can program sprite to move and interact with the user.
5. What is the difference between the script area and stage?
Script Area
This is the place where you add the script blocks to create a program.
Stage
This is where the program runs and you can see Sprite in action.
6. Explain the strategies of debugging? ( Question 6 and 7 may have same answer)
7. Write a note on steps of debugging.
1. Identification of the Error: Identification of error is the initial and the integral part of the entire process of Debugging. An incorrect identification of an error can be ambiguous and results in is time wastage. It is very important to identify the actual error.
2. Find the Location of the error: After the correct identification, you need to go through
the code to locate the exact spot where the error occurred. At this stage, one needs to focus on finding the error instead of understanding it.
3. Analyze the Error: In the third step, you need to use a bottom-up approach from the
error location and analyze the code. This helps in understanding the error better. Analyzing a bug mainly has two goals, such as checking around the error for errors to be found, and to make sure about the risks of entering any collateral damage in the fix.
4. Prove the Analysis: Once you have analysis the bug, you need to scrutinize the program to look for a few more errors that may appear on the application. This step involves writing automated tests for these areas with the help of a test framework.
5. Cover Lateral Damage: In this stage, you need to create or gather all the unit tests for the code where you are going to make changes. Now if you run these unit tests, they all should pass.
6. Fix & Validate: The final stage is to fix all the errors and run all the test scripts to check if they all pass.
Fill in the blank with the appropriate terms.
1. The Sound block category has the block to play sounds.
2. The Sensing block category has the block to allow Sprite to ask question.
3. The Motion block category enables the Sprite to move.
4. The Control block category has the blocks to control the flow of instructions.
5. The Sensing Block category has the blocks to help Sprite detect its environment.