Sunday, September 22, 2019

Write a Qbasic program to display the number series ......


Write a Qbasic program to display the number series
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15

CLS
FOR I = 1 TO 5
D = 4
A = I
FOR J = 1 TO I
PRINT A;
A = A + D
D = D - 1
NEXT J
PRINT
NEXT I
END





Monday, September 9, 2019

Write a Qbasic program to display the number series 5, 54, 543, 5432, 54321

Write a Qbasic program to display the number series 5, 54, 543, 5432, 54321

CLS
FOR i = 5 TO 1 STEP -1
    FOR j = 5 TO i STEP -1
        PRINT j;
    NEXT j
    PRINT
NEXT i
END

Tuesday, August 27, 2019

Qbasic Program to display 1,2,4,7,11,.....10 th term

2076 B.S. Bhadra 10 - Qbasic Program 02
Qbasic Program to display 1,2,4,7,11,.....10 th term


CLS
a = 1
b = 1
i=1
WHILE i<=10
PRINT a
a = a + b
b = b + 1
i = i + 1
WEND
END

Saturday, August 17, 2019

Qbasic Program to display 2,4,12,48....upto 10th term


2076 B.S. Bhadra 01 - Qbasic Program 01

Qbasic Program to display 2,4,12,48....upto 10th term




CLS
a = 2
b = 2
FOR i = 1 TO 10
PRINT a
a = a * b
b = b + 1
NEXT i
END

Tuesday, July 9, 2019

C Programming

C Language



1)     Define C-language.Ans: C-language is a structured programming language that divides program into many functions.
2)     When and who developed C-language?Ans: Dennis Ritchie at Bell telephone laboratory developed C-language in 1972 AD.
3)     Why is C called middle level language?Ans: C is called middle level language because it combines elements of high level language with some features of assembler. A high level language tries to give programmer everything through built-in language. A low level language forces programmer to define function directly from user level.
4)     What are the uses of C-language?Ans: C is mostly used to write system program such as operating system, language, compiler, text editor, language interpreters, utilities, etc.
5)     List the basic data types used in C with their memory consumption.Ans: The basic data types used in C are:
Data Type
Description
Byte
Range
char
Character
1
0-255
int
Integer
2
-33767-32767
float
Single precision
4
6 digits of precision
double
Double precision
8
12 digits of precision
Data Modifiers: Data modifiers change the meaning of the basic data type to fit the various situations. The data modifiers are:

Data Type
Description
Byte
Range
short int
Short integer
2
-33767-32767
unsigned int
Unsigned Integer
2
0 to 65535
long int
Long integer
4
-4294967296 to 4294967295

6)     List the characteristics of C-language.Ans: The characteristics are :
i) It is a high level language with some features of low level language.
ii) It is mostly used to prepare system software.
iii) It is structured programming language with function procedure.
iv) It supports local and global variable.
v) It has only 32 characters.

7)     What are operators? What are the different types of C operator?
Ans: Operators are special symbols that are meant for specific tasks or operators.
The different types of C operators are:-
Arithmetic operators
Assignment operators
Unary operators
Relational operators
Logical operators
Conditional operators

8)     What are urinary operators? State the rules of logical operators.
Ans: The operator that operates on one operand variable or constant is called urinary operator.
The logical operator are:
1) // It connects two expression into one.
2) && operators connects two expression into one. Both expression must be true for the overall   expression must be true for the overall expression to be true
3) ! operator reverses the “true” of an expression

9)     Why is C language popular  than QBASIC?
Ans: Due to the following reasons C language is popular than QBASIC
1)     It is reliable, simple and easy to use
2)     Programs written in care efficient and fast
3)     It occupies less memory space
4)     Programs written in C can be reused

10) What do you mean by source code and object code?
Ans: The instructions written using C language is known as source code.
Thr machine – readable code which is obtained after translation is called object code.

11) What is structured programming ?
Ans: The programming that follows a top- down approach, on which developers separate the overall program structure into different sub selection is called structured programming.

12) Write any two advantages of structured programming ?
Ans: The two advantages of structured programming are:
a)     It is easy to design code and test the program modules independently
b)     It is possible to use a single module in different in different places which reduces program codes.  

13) Write down the features of C- language.
Ans: The features of structured language are:
a)     C is the structured programming language.
b)     C has powerful set of operators.
c)     C is a high level programming language.
d)     C contains very less number of keywords

14) Comparing C and QBASIC languages.
Ans:
QBASIC
C
It is a high level language without feature of low level language.
It is a high level language with some features of low level language.
It is mostly used to design application software.
It is mostly used to prepare system software.
It supports structure programming with sub and function procedure.
It is a structured programming language with function procedure.
It supports local and global variable.
It also supports local and global variable.
IBM PC version of BASIC has around 159 keywords.
It has only 32 keywords.

       
15) What is top-down designing model?
Ans: Dividing a complex task into many small modules into order to perform the task is called top-down design.

16) Mention the advantages of C language.
Ans: Advantages of C language:
a)     Readability
b)     Maintainability
c)     Portability
d)     Reusability

17) What are different types of C language?
Ans: Different types of C language are:
a)     Common C
b)     ANSI C

18) What do you mean by source code and object code?
Ans: The machine readable code written which is obtained after the translation is called object code.
The instructions written using C language C language is known as source code.

19) What are the advantages of C language?
Ans: the advantages of C language are:-
a)     It is machine independent programming language
b)     It is easy to learn and implemented C language
c)     It can be implemented from mobile device to mainframe computers.
d)     It is the mother of all modern programming language like python, pearl 5 and PHP

20) What are the disadvantages of C language?
Ans: The disadvantages of C languages are:-
a)     There is no runtime checking. It has poor errors detection system.
b)     On large programs , it is hard to find errors.
c)     There is no strict type checking int data type to float variables.
d)     It does not support modern programming methodologies oriented programming language.

21) Define counter and accumulator in terms looping.
Ans: A counter is a variable which controls the loop statement and provides the track to run the loop statement in certain number times.
Accumulator is a numeric variable which accumulates the values in a loop statement.

File Handling | Qbasic

Handling of Data File



1)     What is data file? What are the different types of data file?
Ans: The file which contains data given by the user to the program and information provided by the user to the computer is called data file.
The different types of data file are:
a.      Sequential Access files
b.     Random access files

2)     What is a file? Name the two types of data file in data processing.
Ans: A bunch of bytes stored on some storage device like magnetic tape, magnetic disk and optical disk is called file.
The two different types of file in data processing are:
a.      Program file
b.     Data file

3)     What do you mean by program file and data file?
Ans) The file which contains a set of instructions that are needed for data processing is called program file.
The file which contains only data that are required during data processing is called data file.

4)     What is sequential access data file?
Ans) A data file that stores a sequential data file containing name, address of some people in the same order or in sequential order is called sequential access data file.

5)     What are the disadvantages of sequential access data file?
Ans) The disadvantages of sequential access data file are:
a)     It takes long time to access if the data file contains a large volume of data.
b)     In sequential access data file we cannot change the existing entry or insert a new entry.

6)     Mention the difference between program files and data files.
Ans:
Program files
Data files
A program file has set of instructions needed for data processing.
A data file has collection of related data stored in a secondary storage.

7)     What are the difference between PRINT# and WRITE# statements?
Ans:
PRINT#
WRITE#
It adds spaces between data items while storing data.
It inserts commas between the data items.
It does not enclose strings in double quotation marks.
It encloses strings in double quotation marks.

8)     What is a file number?
Ans: The number assigned to a file in order to identify it during processing is called file number.

9)     List the modes of operations for opening a sequential file.Ans: The modes of operation for opening a sequential file are:
i) Output Mode: It is used to create a new data file and write data in it.
ii) Input Mode: It is used to retrieve records or contents of existing data file.
iii) Append Mode: It is used to add more records in existing file.
10) Differentiate between output mode and append mode.Ans:
OUTPUT mode
APPEND mode
i)  It creates a new file and prepares to write data to the file.
i) It opens an existing file and prepares to add data to the file.
ii) If the file already exists its current contents will be destroyed.
ii) If the specified file does not exist APPEND mode creates it.

11) Write down the functions of:
a) OPEN statement:
It opens a sequential file for one of the three possible operations (reading, writing, appending).
b) WRITE statement:It sends one or more data items to the specified file.
c) CLOSE statement:It closes one or all open files.
d) INPUT# statement:It reads data from the sequential data file.
e) EOF() function:It detects the end of the file marker reading the data from an open sequential file.
f) LINE INPUT statement:It reads the entire line or maximum 255 characters form the keyboard or the sequential file.
g) INPUT$ function:It reads the specified number of characters form the data file.
h) NAME statement:The NAME statement renames a file on a diskette. Only file name changes, data and program line remains intact.
i) KILL statement:The KILL statement deletes the file or files from the specified drive and directory.
j) MKDIR statement:It creates a subdirectory which is used to manage files.
k) CHDIR statement:It allows QBASIC to change from one directory to another.
l) RMDIR statement:It is used to remove or delete only the subdirectories from a disk. It can remove only empty subdirectories.
m) FILES statement:
The FILES statement displays the files of the current sub directory or specified sub directory.