Very Short Questions Fall 2020 || Programming Language

Very Short Questions Fall 2020

Very Short Questions Fall 2020

The answer to the Very Short Questions Fall 2020 are given below:

1. Define header file with example.

ANS- A file that contains a class declaration is called header file. The name of the class is usually the same as the name of the class, with a.h extension. For example, the Time class would be declared in the file Time.h.

2. What is the different generation of computer language?

ANS-The different generations of computer language are given below:

  • First generation (1940 – 1956)
  • Second generation (1956 – 1963)
  • Third generation (1964 – 1971)
  • Fourth generation (1972 – 2010)
  • Fifth generation (2010 to present)

3. What is the difference between prefix and postfix increment and decrement operators?\

ANS- Prefix and Postfix Operators are primarily used in relation to increment and decrement operators. If the increment and decrement operators are written before the operand, then they are termed as prefix operators. However, if they are written after the operand, then they are termed as postfix operators.

4. Define a global variable and a local variable.

ANS- Local variable is declared inside a function whereas Global variable is declared outside the function. Local variables are created when the function has started execution and is lost when the function terminates, on the other hand, Global variable is created as execution starts and is lost when the program ends.

5. What is a function? Write the advantages of function. 

ANS-

A function is a group of statements that together perform a task. Every C program has at least one function, which is main (), and all the most trivial programs can define additional functions. You can divide up your code into separate functions. Advantages of function are given below:

  • Use of functions enhances the readability of a program. A big code is always difficult to read. Breaking the code in smaller Functions keeps the program organized, easy to understand and makes it reusable.
  • The C compiler follows top-to-down execution, so the control flow can be easily managed in case of functions. The control will always come back to the main() function.

6. Explain the array with a simple example.

ANS- An array is a collection of similar types of data. For example, if we want to store the names of 100 people then we can create an array of the string type that can store 100 names. String [] array = new String ; Here, the above array cannot store more than 100 names.

7. Differentiate between the operator % and /. 

ANS- & operator is used to Returns the address of a memory location. -> is used in structure and union member access through a pointer.

8. Write the syntax of the switch statement.

ANS-

switch(expression) {

case constant-expression :
statement(s);
break; /* optional */

case constant-expression :
statement(s);
break; /* optional */

/* you can have any number of case statements */
default : /* Optional */
statement(s);
}

9. Mention some characteristics of a good algorithm. Define identifier and write the rules for naming identifier.

ANS- The characteristics of a good algorithm are given below:

  • Finiteness, means it must always terminate after a finite number of steps.
  • Definiteness, means each step must be precisely defined and clear.

Rules for Naming C Identifiers are given below:

  • An identifier can only start with letter (A-Z, a-z) or underscore( _ ) symbol.
  • An identifier can contain alphabet, digits(0-9), and underscore only.

10. Write syntax for the do-while loop.

ANS- do
{
// the body of the loop
}
while (testExpression);

You may also like Pokhara University || Fall 2020 || Programing Language

Be the first to comment

Leave a Reply

Your email address will not be published.


*