Very Short Questions Spring 2015
The answers to Very Short Questions Spring 2015 are given below:
1. What is a Programming Language?
ANS- A programming language is a computer language programmers use to develop software programs, scripts, or other sets of instructions for computers to execute. Although many languages share similarities, each has its own syntax.
2. What are header files? Why are they important?
ANS- A header file is a file with extension.h which contains C function declarations and macro definitions to be shared between several source files. There are two types of header files: the files that the programmer writes and the files that come with your compiler.
In C language, header files contain the set of predefined standard library functions. Our request to use a header file in your program by including it with the C preprocessing directive “#include”.
3. Define identifier and write the rules for naming identifier.
ANS- Identifier is a name that is given to various program elements such as variables, symbolic constants, functions, structures or enums. The identifier is used to identify a user-defined item. The rules for naming identifiers are:
- An identifier can only start with the letter (A-Z, a-z) or underscore( _ ) symbol.
- An identifier can contain the alphabet, digits(0-9), and underscore only.
- The identifier must not contain white spaces.
- A keyword can not use as an identifier.
4. What the difference between variable and constant?
ANS- Simply put, a variable is a value that is changing or that have the ability to change. A constant is a value that remains unchanged. For example, if we have a program that has a list of 10 radii and we want to calculate the area for all of these circles.
5. Write syntax for the do-while loop.
ANS- The syntax of a do…while loop in C programming language is:
} while( condition );
6. What does FILE *fp mean?
ANS- The FILE *fp declares a variable fp which is a pointer to a FILE and a function fopen which returns a pointer to a FILE.
7. What is the function prototype?
ANS- In computer programming, a function prototype or function interface is a declaration of a function that specifies the function’s name and type signature ( arity, data types of parameters, and return type ), but omits the function body.
8. Explain about pre-processor directive?
ANS- Preprocessor directives are lines included in a program that begin with the character #, which make them different from a typical source code text. They are invoked by the compiler to process some programs before compilation. Preprocessor directives change the text of the source code and the result is a new source code without these directives.
9. Differentiate between the operator % and /.
ANS- “%” is modulo operator, represented by a percentage sign ( % ), gives the remainder of a division of two values. “/” is a divisor, gives the division of two values.
10. Debug the errors of the given program.
int v=10; *p;
int v=10; *p;
You may also like Pokhara University || Spring 2015 || Programming Language