Project Work
Of
Computer
1. Define Operator. List
its types with examples.
Þ
Operators are symbols,
which are used for mathematical calculations, logical and string
operations. Its types with examples are as follow:
·
Arithmetic operators:
E.g.: +, -, *, /, \, ^ and MOD.
Use: PRINT 4+5
·
Relational operators:
E.g.: =, <>, <, >, <=
and >=
Use: PRINT 6>=5
·
Logical operators:
E.g.: AND, OR and NOT
Use: PRINT 6>5 OR 5>6
·
String operators:
E.g.: +
Use: PRINT A$ + B$
2. Define Operand. Explain with example.
Þ Operands may be constant values or variables on which mathematical and logical operations take place. For example: In the following expression,
S = 4 / 2
/ is operator, and
4 and 2 are operands.
3. Define
Expression. List its types with examples.
Þ
An expression
can be a string or numeric constant, a variable or a combination of constants
and variables with operators. Its types
with examples are as follows:
·
Arithmetic
expression
E.g.:
PRINT 7 * 6 +
5
Z = (X^2) +
(Y^3)
·
Logical
expression
E.g.:
PRINT 5>6
PRINT 3<4
·
String
expression
E.g.:
PRINT A$ + B$
PRINT
Kathmandu $ + Nepal$
4. What is Arithmetic Operator? Explain with examples.
Þ Arithmetic or mathematical operators are symbols, which are used for mathematical operators which assign the result of an arithmetic expression to a variable or displays on the monitor. For example: +, -, *, /, \, ^ and MOD.
5. Discuss about Operator Precedence.
Þ In the presence of more than one operator in QBASIC, QBASIC follows a certain order for performing the operations. The order in which the QBASIC performs the operation is known as operator precedence or hierarchy of operations.
The operator precedence in QBASIC is:
· ()
· ^
· - (negative)
· * /
· \
· MOD
· +,-
· =
· <>
· <
· <=
· >
· >=
· NOT
· AND
· OR
6. What is Logical Operator? Explain with
examples.
Þ
Logical operators are symbols, which are used
to combine two or more logical or relational expressions and returns a single
‘true’ or ‘false’ value. For example: AND, OR and NOT.
7. What is Relational Operator? Explain with examples.
Þ Relational operators are symbols, which are used in relational or logical expressions. For example: =, <>, <, >, <= and >=.
8. Show the truth table of AND, OR and NOT
operator.
Þ
The truth table are
as follows:
·
For AND operator:
Condition
|
Operator (AND)
|
Condition
|
Result
|
True (-1)
|
AND
|
True (-1)
|
True (-1)
|
True (-1)
|
AND
|
False (0)
|
False (0)
|
False (0)
|
AND
|
True (-1)
|
False (0)
|
False (0)
|
AND
|
False (0)
|
False (0)
|
·
For Or operator:
Condition
|
Operator
(OR) |
Condition
|
Result
|
True (-1)
|
OR
|
True (-1)
|
True (-1)
|
True (-1)
|
OR
|
False (0)
|
True (-1)
|
False (0)
|
OR
|
True (-1)
|
True (-1)
|
False (0)
|
OR
|
False (0)
|
False (0)
|
·
For NOT operator:
Condition
|
Result
|
True (-1)
|
False (0)
|
False (0)
|
True (-1)
|
9. What is String Operator? Explain with examples.
Þ String operator is a symbol like + (plus), which is used to combine two or more strings. For example: +
10. Write any ten possible conditions or Boolean expressions that exist between A and B, where A=12 and B=13.
Þ Any ten possible conditions or Boolean expressions that exist between A and B, where A= 12 and B=13 are as follows:
· A=B
· A<>B
· A<B
· A>B
· A<=B
· A>=B
· A>B OR B>A
· A<B OR B<A
· NOT A<B
· NOT B<A
11. Define numeric data and string data. Give examples also.
Þ Definitions:
· Numeric data:
All the positive and negative numbers are known as numeric data. For example: 12, 28, 189, -45, -168, etc.
· String data:
A text value that consists of alphabets, numbers and other special symbols are known as string data. For example: “Kathmandu”, “Nepal”, etc.
12. What is constant? List its type with examples.
Þ Constants are values, which are remained fixed during the execution of a program. Its types with examples are as follows:
· Numeric constant
E.g.: 500, 1200, etc.
· String constant
E.g.: “Kathmandu”, “My name is Sarika Shrestha”, etc.
13. Define string and numeric constant with
examples.
Þ
Definitions:
·
String constant:
A text value that
consists of alphabets, digits, symbols and other special characters is known as
string constant. For example: “PSY”, “CHABAHIL, 7” , etc.
·
Numeric constant:
All numeric values
or data i.e. all the positive, negative and decimal numbers are known as
numeric constant. For example: 500, 2.8, -92, etc.
14. What is variable? List its type with examples.
Þ An identifier or reference or name for the memory address that holds data and changes its value during the execution of a program which is written with the combination of letters, numbers and special characters with certain rules is known as variable. Its types with examples are as follows:
· Numeric variable
E.g.: N, N&, N%, N#, etc.
· String variable
E.g.: “Roll$”, “Kathmandu$”, etc.
15. Define string and numeric variable with examples.
Þ Definitions:
· Numeric variable:
A name or reference, which stores a positive or negative number, is known as numeric variable. For example: A1, N, B#, etc.
· String variable:
A name or reference or memory location, which stores alphanumeric characters, is known as string variable. For example: “Kathmandu”, “Saurav”, etc.
16. Write the characteristics of variable.
Þ
The characteristics
of variables are as follows:
·
Each variable has a name.
· Each variable has a type.
· Each variable has a value that we specify.
17. List rules for naming variable.
Þ
The
rules for naming a variables are as follows:
·
A
variable name must start with an alphabet (A to Z or a to z). “A10” is a valid variable name.
·
A
variable name may have 1 to 40 characters in length.
·
A
variable name should not contain a blank space or special characters other than
letters, numbers, periods (.) and data type declaration symbols ( %, &, !,
# and $). “A 10” is an invalid variable
name because of its space.
·
A
variable name must not start with “FN”, because it is a reserved for the
user-defined function.”FNnum” is an invalid variable name.
·
Other
reserved words or keywords of QBASIC are not allowed to use as a variable name.
For example, “LET” is an invalid variable name because “LET” is a reserved word
of QBASIC.
18. What are the types of numeric variable?
Explain with example.
Þ
The types of numeric
variable are as follows:
·
Integers-
Positive or negative
whole numbers are known as integers. The legal range of integer data type is
from -32,768 to 32,767. QBASIC stores each integer’s value with two bytes of
memory. The “%” symbol is used to indicate integers. For example: NUM%, R1%,
etc.
·
Long integers-
A long range of
whole numbers is known as long integers. The legal range of long integer data
type is from -2,147,483,648 to 2,147,483,647. QBASIC needs four bytes memory to
store each long integer number. The “&” symbol is used to indicate long
integer. For example: NUM&, P&, etc.
·
Single precision-
Single precision
stores the number with accuracy up to 7 digits. Single precision numbers can be
written in different ways. The most common way to write the number is number
with a decimal point. QBASIC needs four bytes memory to store each single
precision data. The “!” symbol is used to indicate single precision data. For example:
NUM! , P!, etc.
·
Double precision-
Double precision is
a numeric data that supports a long range of values with rational parts. Qbasic
needs 8 bytes memory to store each double precision. Double precision stores the
number with accuracy up to 15 digits. The “#” symbol is used to indicate double
precision data. For example: NUM#, P#, etc.
19. Define implicit and
explicit declaration of variable with example.
Þ
Definitions:
·
Implicit declaration:
Declaration of variable at the place of assigning a value to the
variable is called implicit declaration. It can be done by using suffix symbols
(%, &,!, #, $). For example: LET N$ =”Nepal”: where $is declares as string variable
to store string Nepal.
·
Explicit declaration:
Declaration of variable before you use it or before assigning
data to the variable in the program is known as explicit declaration. For
example: DIM N%, P$: where N% is declared as an integer and P$ is declared as a
string variable explicitly.
20. Write short notes on
Qbasic.
Þ
QBASIC stands for Quick Beginner’s All Purpose Symbolic
Instruction Code. It is a high-level language which is simple to learn and use,
developed by Microsoft Corporation. It was released with MS-DOS 5.0 operating
system. It contains two files: QBASIC>EXE
and QBASIC.HLP. Since then, nearly every PC user owns their own copy of QBASIC,
making it a widely known language. QBASIC can be used for scientific as well as
commercial applications.
Submitted to,
Deepak sir