## State whether the following statements are True/False

#### Question 1

INPUT N$ will accept a string constant.**True**

#### Question 2

A question mark is displayed on the screen while executing an INPUT statement.**True**

#### Question 3

INPUT A, B, C will accept only one numeric constant.**False**

#### Question 4

A numeric variable with the INPUT statement responds to a string constant.**False**

#### Question 5

A message may be given along with an INPUT statement to make the program user-friendly.**True**

#### Question 6

Numeric or alphanumeric constants should not be used along with the INPUT statement.**False**

#### Question 7

INPUT N$,M will accept one alphanumeric constant and one numeric constant.**True**

#### Question 8

INPUT statement accepts the data value during execution of the program.**True**

#### Question 9

There is no difference between LET and INPUT statement in QBASIC.**False**

#### Question 10

INPUT "Information Technology" is a valid statement.**False**

## Complete the program

#### Question 1

CLS

PRINT "Enter two numbers"

INPUT ...........

........... = A+B

........... = A*B

PRINT "The sum of two numbers ="; S

PRINT "The product of two numbers ="; P

...........

**Answer**

CLS

PRINT "Enter two numbers"

INPUT A,B

S = A+B

P = A*B

PRINT "The sum of two numbers ="; S

PRINT "The product of two numbers ="; P

END

#### Question 2

CLS

INPUT "Enter the name of article"; N$

INPUT "Enter the number of articles"; P

INPUT "Enter the price of article"; ...........

M = P * Q

PRINT "Name of the article is"; ...........

PRINT "Total cost of the articles is"; ...........

END

**Answer**

CLS

INPUT "Enter the name of article"; N$

INPUT "Enter the number of articles"; P

INPUT "Enter the price of article"; Q

LET M = P * Q

PRINT "Name of the article is"; N$

PRINT "Total cost of the articles is"; M

END

#### Question 3

CLS

PRINT "What do you want to buy?"

PRINT "Enter T$ for toy

INPUT ...........

PRINT "How many"; T$; "Want to buy"

INPUT ...........

PRINT "I want to buy"; N; T$

...........

**Answer**

CLS

PRINT "What do you want to buy?"

PRINT "Enter T$ for toy"

INPUT T$

PRINT "How many"; T$; "Want to buy"

INPUT N

PRINT "I want to buy"; N; T$

END

#### Question 4

CLS

PRINT "What is the cost of this pen?"

INPUT ...........

PRINT "How many pens do you want?"

INPUT ...........

T = P * Q

PRINT "Total cost ="; ...........

...........

**Answer**

CLS

PRINT "What is the cost of this pen?"

INPUT P

PRINT "How many pens do you want?"

INPUT Q

T = P * Q

PRINT "Total cost ="; T

END

## Short Answer Questions

#### Question 1

What is the purpose of using INPUT statement in a program?

**Answer**

INPUT statement is used to make the program user-friendly. With the use of INPUT statement, the user can enter any data to a variable at the time of execution.

When the INPUT command is used, the computer displays a question mark on the screen and asks the user to enter the data.

#### Question 2

How does LET statement differ from an INPUT statement?

**Answer**

LET statement | INPUT statement |
---|---|

LET statement is used to assign a value to a variable at the time of development of the program. | INPUT statement allows the user to assign values to variables at the time of execution of the program. |

LET statement doesn't make the program user-friendly. | INPUT statement makes the program user-friendly. |

#### Question 3

Write down the syntax of:

(a) INPUT statement with a numeric variable.

(b) INPUT statement with an alphanumeric variable.

**Answer**

The syntax of INPUT statement with a numeric variable is as follows:

```
INPUT <numeric variable>
```

The syntax of INPUT statement with an alphanumeric variable is as follows:

```
INPUT <alphanumeric variable>
```

## BASIC Programming

#### Question 1

Write a program in QBASIC to make a name sticker which includes your name, class, roll no., subject and school using INPUT statement. Display the output in the given format:

```
Name :
Class :
Roll No.:
Subject :
School :
```

##### Solution

```
Cls
Input "Enter name"; N$
Input "Enter class"; C$
Input "Enter roll no. "; RN
Input "Enter Subject "; SUB$
Input "Enter school name "; S$
Print "Name : "; N$
Print "Class : "; C$
Print "Roll No : "; RN
Print "Subject : "; SUB$
Print "School : "; S$
End
```

##### Output

```
Enter name? Mishi
Enter class? VI-A
Enter roll no.? 23
Enter Subject? Computer
Enter school name? City Montessori School
Name : Mishi
Class : VI-A
Roll No : 23
Subject : Computer
School : City Montessori School
```

#### Question 2

Write a program in QBASIC format to accept the length of a rod in millimetres and express the same in centimetres and metres.

##### Solution

```
Cls
Input "Enter the length of the rod in mm "; L
Let Lcm = L / 10
Let Lm = L / 1000
Print "Length of rod = "; L; " mm"
Print "Length in centimetres = "; Lcm; " cm"
print "Length in metres = ";Lm ; " m"
End
```

##### Output

```
Enter the length of the rod in mm ? 3000
Length of rod = 3000 mm
Length in centimetres = 300 cm
Length in metres = 3 m
```

#### Question 3

Write a program in QBASIC format to print the total amount paid to the shopkeeper for purchasing the following items:

```
Number of exercise books = 10
Number of brown paper rolls = 4
```

##### Solution

```
Cls
Let books = 10
Let rolls = 4
Input "Enter the price of exercise books "; p1
Input "Enter the price of paper rolls "; p2
Let total = books * p1 + rolls * p2
Print "Total Amount = Rs. "; total
End
```

##### Output

```
Enter the price of exercise books ? 200
Enter the price of paper rolls ? 20
Total Amount = Rs. 2080
```

#### Question 4

Write a program in QBASIC to find the value of the given expressions after taking a suitable value of a and b from the console:

- a
^{2}+b^{2} - (a+b) / ab

##### Solution

```
Cls
Input "Enter value of a "; a
Input "Enter value of b "; b
Let ans = a * a + b * b
Print "Value of expression 1 = "; ans
Let ans = (a + b) / (a * b)
Print "Value of expression 2 = "; ans
End
```

##### Output

```
Enter value of a ? 4
Enter value of b ? 5
Value of expression 1 = 41
Value of expression 2 = .45
```

#### Question 5

You want to calculate the total runs made by Sachin Tendulkar only in terms of centuries and half-centuries in test matches. Write a program in the QBASIC format taking the numbers of centuries and half-centuries as input. Display the total runs made by Sachin in centuries and half-centuries separately.

##### Solution

```
Cls
Input "Enter the number of centuries "; c
Let runs = c * 100
Print "Total runs in "; c; " centuries = "; runs
Input "Enter the number of half-centuries "; hc
Let runs = hc * 50
Print "Total runs in"; hc; " half-centuries = "; runs
End
```

##### Output

```
Enter the number of centuries ? 250
Total runs in 250 centuries = 25000
Enter the number of half-centuries ? 570
Total runs in 570 half-centuries = 28500
```

#### Question 6

In an examination, 20% students failed in English and 30% failed in Maths. Write a program in QBASIC format to find the total number of students who failed in both the subjects taking the total number of students in the class as input.

##### Solution

```
Cls
Input "Enter the total strength of the class "; onroll
Let e = 20 / 100 * onroll
Let m = 30 / 100 * onroll
Let total = e + m
Print "Number of students who failed in both the subjects ="; total
End
```

##### Output

```
Enter the total strength of the class ? 50
Number of students who failed in both the subjects = 25
```

#### Question 7

Write a program in QBASIC format to find the value of 's' in the given equation, taking the suitable value of 'u' , 'v' and 'a' as input.

s = (v^{2} - u^{2}) / 2a

##### Solution

```
Cls
Input "Enter the value of u"; u
Input "Enter the value of v"; v
Input "Enter the value of a"; a
Let s = (v * v - u * u) / (2 * a)
Print "Value of s = "; s
End
```

##### Output

```
Enter the value of u ? 20
Enter the value of v ? 30
Enter the value of a ? 5
Value of s = 50
```

#### Question 8

You purchased a Computer textbook and an Oxford dictionary. The shopkeeper allows 10% discount on the textbook and 20% discount on the dictionary. Write a program in QBASIC format to calculate the total discount and the amount to be paid to the shopkeeper, taking price of the books as input.

##### Solution

```
Cls
Input "Enter price of Computer book "; cb
Input "Enter price of dictionary "; d
Let d1 = 10 / 100 * cb
Let d2 = 20 / 100 * d
Let discount = d1 + d2
Print "Total discount = Rs. "; discount
Let cost = cb + d - discount
Print "Amount to be paid = Rs. "; cost
End
```

##### Output

```
Enter price of Computer book ? 500
Enter price of dictionary ? 1000
Total discount = Rs. 250
Amount to be paid = Rs. 1250
```