Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Saturday, July 8, 2023

Exploring Modular Programming in QBasic: Very Short Questions and Answers


Exploring Modular Programming in QBasic: Very Short Questions and Answers





Introduction


Modular programming in QBasic is a programming paradigm that divides a program into independent, reusable modules. Each module performs a specific task and can be called from other modules as needed. This makes modular programming a good way to improve the readability, maintainability, and scalability of programs.

In this blog post, we will answer some very short questions about modular programming in QBasic which is very useful for computer science students of grade 10 and SEE. We will cover topics such as what a module is, the benefits of using modular programming, how to create and call modules, and the different types of modules.

Answer the following questions in one sentence:

1) What is user-defined function? (Specification Grid 2065, SLC supplementary 2066)

Ans: Function which are defined by the user according to their need are called user defined function.

2) Write down the difference between function and sub procedure. (SLC supplementary 2065)


Ans: The main difference between subroutines and functions is that functions return a value. Subroutines do not return a value.


3) What is the procedure? List its types. (SLC 2067, SEE 2072)


Ans: A small, logical, and manageable functional part of the program is known as a procedure. 
OR,

It is a collection of code to perform an action that does not return a value. Its types are:
i) Sub-procedure
ii) Function procedure. 

4) What is a subroutine?

Ans: Subroutine is a set of program statements that can be called from different places of the main program.


5) Write the features of the subroutine.

Ans: The features of the subroutine are as follows:
  • It is called by CALL keyword.
  • It does not return any value.
  • It does not consider data type.
  • It can be recursive.

6) What do you mean by procedure?

Ans: Procedure is a collection of code to perform an action which does not return a value. There are two types of procedures:
i) Sub-procedures
ii) Function procedures


7) Write the importance of the subroutine.


Ans: When our program becomes bigger, its code becomes more and more difficult to understand and difficult to find out the bugs, then with the help of a subroutine we can make the program more simple and easier.


8) What do you mean by recursion?

Ans: A sub-program or module that can call itself is called recursion.


9) What is a variable?

Ans: The entity of number or string whose value are changeable during the program execution time is called variable.


10) Write the difference between local and global variable.

Ans: The variable declared inside the procedures is called the local variable. The variable, which can be accessed from any procedure or module is called a global variable.


11) What is a declare statement? Write its syntax.

Ans: It declares function or sub procedure and invokes arguments data type checking.

Syntax:

DECLARE SUB/FUNCTION name (parameter list)



12) Distinguish between shared and common shared.

Ans: SHARED statement gives procedures access to module-level variables. COMMON SHARED statement defines a global variable that can be shared throughout a program or between chained programs.


13) Define Function….End function.

Ans: It is a non-executable statement that declares the name, the parameters, and the code that form the body of a function procedure.


14) Write the types of functions.

Ans: There are two types of functions. They are as follows.

i) Library or built-in – function
These functions are provided by Qbasic software. eg. sqr( ), int( ), left$( ), len( ), mid$( ), date$( ) etc..
ii) User-defined functions
Functions, which are defined by the user according to the need are called user-defined functions.


15) Write the advantages of the function.

Ans: Following are the advantages of functions.
  • There is no chance of duplication.
  • It can be developed, tested, debugged, and compiled independently.
  • Each function is reusable.
  • Program can be developed in a short period of time.
  • Large numbers of programmers can be involved.

16) In how many ways we can pass the arguments in function and procedure?

Ans: We can pass the arguments in function and procedure as follows:
i) By reference
ii) By value
iii) By enter array into the function


17) What do you mean by parameter?

Ans: Parameters are variables that will receive data sent to the procedure. (Sub-procedure and function)

OR

Parameters are the pre-defined variable that indicates the input given to the sub-procedure.



18) Define arguments.

Ans: Arguments are the actual values, we pass to the sub-procedure.


19) Difference between actual parameters and formal parameters. (SEE 2074)

Ans: The parameter listed in a function call are called the actual parameters. The parameters included in function declarations are called formal parameters.


20) What is a loop? (SLC 2068, Supp 2070, SEE 2073)

Ans: The repetition of statements the number of times on the basis of a given condition is known as a loop.


21) What is a module in QBasic?

Ans: A module in QBasic is a self-contained piece of code that performs a specific task. Modules are defined using the SUB or FUNCTION keyword.


22) What is a variable? (SLC 2070)

Ans: A variable is a location in the memory, the contents of which can be changed during the execution of the program.


23) What is a constant?

Ans: The entity (data or value) which cannot be changed during the program execution is called constant.


24) What is an operator?

Ans: An operator is a symbol or sign used to indicate a specific operation between the operands in a program.


25) What is a statement?

Ans: A statement is a set of instructions written using keywords or commands of programming language.


26) Write the difference between the Argument and the parameter.

Ans: Arguments are values that are sent to the procedure. Parameters are variables that will receive data sent to the procedure.


27) Write down the function of DECLARE statement.

Ans: The function of DECLARE statement is to declare a procedure such as FUNCTION or SUB in modular programming.



28) Define logical operators. (SEE 2075)

Ans: Logical operators are symbols, which are used to combine two or more logical or relational expressions and return a single ‘true’ or ‘false’ value.


29) Write the difference between library functions and user-defined functions

Ans: Library functions are built-in or predefined functions of QBASIC. Example: LEN, LEFT$, DATE$.  User-defined functions are defined or declared by the user. FUNCTION cube(a)


30) What do you mean by modular programming? (Specification Grid 2077)

Ans: Modular programming is the process of dividing a large computer program into separate sub-programs.


31) Which statement is used to call sub-procedure? (SEE 2078)

Ans: To call the sub procedure CALL statement is used.


32) Write any two advantages of modular programming. (SEE Grade Promotion 2078)

Ans: Following are the advantages of modular programming.
i). Easy to write the program.
ii) Easy to find out bugs.


33) What is looping? (SEE 2079)

Ans: Looping is a programming construct that allows a set of instructions to be executed repeatedly until a specific condition is met.


34) How do you create a module in QBasic?

Ans: To create a module in QBasic, you use the SUB or FUNCTION keyword.


Conclusion:


Modular programming is a powerful tool that can be used to improve the readability, maintainability, and scalability of programs. QBasic supports modular programming, and there are several different types of modules that can be used. Functions offer some advantages over subroutines, such as the ability to return values and the potential for increased code reuse. However, functions can also make code more complex and less efficient. The best way to use modules in QBasic depends on the specific needs of the program. After completing this topic, students of grade 10 and SEE will be able to answer very short questions about modular programming on their board exams and score good marks.

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages