Advertisement

BASIC PROGRAMMING.


1. Fill in the blanks:
(1) In computer programming Algorithm refers to a precise method that a computer can use to solve a problem.
(2) An algorithm must always terminate after a finite number of steps.
(3) The person who writes the program is called a programmer.
(4) Selection or branching involves making a choice.
(5) The diamond shaped flowchart symbol is called DECISION BOX.
(6) In a flowchart, the beginning and the end of a program are indicated by TERMINAL BOX.
(7) A Loop is where a part of instructions are repeated until a condition or result is achieved.
(8) Coding means writing the program in computer language.
(9) BASIC,FORTAN and C++ are examples of High level language.
(10) Every statement in a BASIC program should be begin with a Line Number.
(11) A BASIC program file is saved with a extension .Bas.
(12) Character string enclosed within quotation marks is called a  string constant.
(13) In BASIC program, 9.81 is a numeric constant while “9.81” is a string constant.
(14) In a BASIC program , A0 is a numeric variable while C$ is a string variable.
(15) The PRINT statement is used to display numbers and text on the monitor screen.
(16) The INPUT statement displays a question mark on the screen and waits for the user to enter data for the program.
2.    Distinguish between:
[1]                  Algorithm
Flow Chart
Algorithm is a finite step to solve a problem.
Algorithm is difficult to understand, when compared to flow chart.
Flow chart is diagrammatical representation of an algorithm.
Flow chart is very easy to understand.

[2]                  Process Box
Decision Box
Process box shows arithmetic operation on number, or the string
Decision Box shows the condition evaluated for selection.
processing operation on strings of characters.


[3]                  Numeric Constant
String Constant
A numeric constant is a number. Eg. 16.5.
A string constant is a character string enclosed in quotation mark. Eg.   “Navaneet”

[4]                  Numeric Variable
String Variable
A variable which can be assigned a numeric value is called a numeric variable.
A variable to which a string constant may be assigned is called  a string variable

3. Match the following

[1] Column A                      
Column B
  1) INPUT A$     
 (a) Take a string constant from the user and assign it  to a sting variable.
  2) PRINT A$      
(b) Display the value of a string variable on the monitor screen.
  3) LET A = 40    
(c) Assign a numerical constant to the numerical variable A.
  4) READ A              
(d) Assign a numerical constant to the numerical variable A.

     



4.State whether the following statements are true or false :
(1) The statement PRINT A will display the capital letter A. True.
(2) In a BASIC program, a READ statement must have at least one accompanying DATA statement. True.
(3) DOLLAR $ is a valid string variable. False.
(4) The CLS statement should appear preferably at the end of the BASIC program. False.
(5) Every Basic Program should have a END statement at the end of the program. True.
(6) It is not necessary to give a line number in a BASIC program. False.
(7) The BASIC expression 8^-3 means the cube root of 8. False.
(8) A PRINT statement displays a question mark on the screen. False.
(9) REM statements are displayed on the monitor screen as input prompts for the user. False.
(10)     If A= 16.3 and B= 21.8, then the BASIC statement LET B=A will change the value of B but not that of A. False.
5.Answer the following questions in one or two sentences each :
(1)What is a program?
Ans. The complete set of instruction to solve a problem (in computer language) in a finite number of steps is called a program.
(2)What is an algorithm?
Ans. Algorithm is a finite step to solve a problem.
(3)What is a flow chart?
Ans. Flow chart is diagrammatical representation of an algorithm.
(4)What is a numeric expression?
Ans. Any ordinary algebraic expressions involving numeric constants and variables are called numeric expression.
(5)What is   meant by string concatenation?
Ans.  It is process of combining string and string variables, one behind other.
(6)What is branching? what is conditional branching?
Ans. The transfer control from one part of program to another is called branching. If a branching is based on the outcome of a logical decision is called conditional Branching.
(7)What is compiler?
Ans. A compiler is built in program which creates machine code instruction from the high level language.
(8)What is an interpreter?
Ans. An interpreter translates and executes high level language line by line.
(9Name four commonly used high-level languages.
Ans. FORTAN, APL, BASIC and C++.
(10)What does the acronym “BASIC” stand for?
Ans. Beginners All-purpose Symbolic Instruction Code.
(11)When and by whom BASIC was originally developed?
Ans. The BASIC language was created by John Kemeny and Thomas Kurtz at mouth College, U.S.A., in 1964.
(12)In Basic what symbols are used to indicate addition, subtraction, multiplication, division and exponentiation?
Ans. +  = Addition, - = Subtraction, * = multiplication, / = subtraction and ^ = exponentiation.
6.What are the uses of the following flowchart symbols?
(1)Terminal box: Marks the beginning (START) and editing (STOP) of the program flow.
(2)Process box : Shows the arithmetic operation on numbers, or the string.
(3)Decision box :Shows the condition evaluated for selection.
7.Write the basic expression for :
1)Raising 2 to the power 5:  2^5
2)A3-7B+1: (A^3)  - (7*B) +1
3)5(F-32)  : (5*(F-32))/9
4)AMT=PRIN (1+RATE/100)N.  PRIN * (1+(RATE/100)) N.
8.Identify the valid numeric Variables: M, N7, P$, Q#, INT, 7B.
Ans. M, N7, INT, 7B
9.Identify the valid string Constant : “Navaneet, “NPIL”,”INFO-TECH”,34.35,”9.8”.
Ans. “NPIL”,”INFO-TECH”,”9.8”.