Getting Started With C Short Questions and Answers

 

getting started with c short questions answers

Getting Started With C Short Questions and Answers. This is the 2nd post about 2nd Year | ICS Part-II Computer Science Chapter No.8: (Getting Started With C) | Short Questions and Answers. The following questions are very important for the final examinations of all Boards of Punjab as well as Pakistan:


Chapter No.8: Getting Started With C

Short Questions and Answers - 2


Q.1: What is #define directive?


Answer:


#define directive is used to define a constant macro.

Syntax:               #define Macro_Name            expression

Example:            #define PI                            3.142857


Q.2: Define expression?


Answer:


The expression may be constant, arithmetic expression, or a string. C preprocessor replaces each occurrence of the identifier Macro_Name with the value of the expression. The expression of the identifier Macro_Name can not be changed during the program execution.


Q.3: What is Constant Macro?


Answer:


It is a name that is replaced by a particular constant value before the program is sent to the computer.


Q.4: Define the function main?  


Answer:


In fact, main is the function where the execution of the C program begins, every C program has a main function. The rest of the lines of the program forms the body of the main function, the body is enclosed in braces { and }.


Q.5: Define void word in void main (void)?


Answer:


The firs void represents the data type of the value that is returned by the function, which means the function main returns nothing.

The second void enclosed in parenthesis describes that the function main does not accept any argument.


Q.6: Define the term arguments?


Answer:


Arguments can be passed to the main function and it can also return a value.


Q.7: Define body of the main function?


Answer:


The rest of the lines of function main forms the body of the main function, the body of the main function is enclosed in curly braces i.e. { and }.


Q.8: What are delimiters?


Answer:


Next to the function definition are braces, which indicate the beginning and end of the function body. These braces are called delimiters. { indicates opening of the main function whereas { indicates closing of main function.


Q.9: Define statement terminator?


Answer:


Every statement in a C program terminates with a semicolon (;). If any of the statement is missing the statement terminator, the compiler will report “Statement missing” error message.


Q.10: What is the purpose of printf function?


Answer:


It is used to display the output of the program on the screen. The “stdio.h” header file contains the details of printf function; therefore, it must be included.


Q.11: What are bugs and debugging?


Answer:


The programmer may come across errors while writing a computer program, these errors are called bugs and processing of finding and removing these bugs is called debugging.


Q.12: What is syntax error?


Answer:


A syntax error occurs when the program violates one or more grammar rules of C language. Compiler detects these errors as it attempts to translate the program. If syntax error exists, it can not be translated and the program could not be executed.


Q.13: What is run time error?


Answer:


A runtime error occurs when the program directs the computer to perform an illegal operation, such as dividing a number by zero. Runtime error is detected and displayed by the computer during the execution of a program.


Q.14: What is logical error?


Answer:


A logical error occurs when a program follows a faulty algorithm. The compiler or computer can not detect logical error; therefore, no error message is reported and doesn’t program crashed due to logical error. Logical errors can only be detected by thorough testing of the program


Q.15: Define Machine language?


Answer:


Machine language is the native language of the computer. The computer does not need any translator to understand this language.


Q.16: Define assembly language. What are mnemonics?


Answer:


In assembly language, machine language instructions are replaced with English-like words known as mnemonics. An assembler is used to translate assembly language programs into machine language.


Q.17: Define high-level language?


Answer:


Programming languages whose instructions resemble the English language are called high-level languages. Every high language defines a set of rules for writing programs called the syntax of the language.


Q.18: Describe applications of FORTRAN and COBOL?


Answer:


FORTRAN (Formula Translation) has very powerful mathematical capabilities while COBOL (Common Business Oriented Language) is ideal for writing business applications.


Q.19: Describe applications of Java language?


Answer:


Java is a high-level language and equipped with strong network programming features.



2 Comments

Your feedback is highly appreciated and will help us to improve. So, please give your good suggestions.

Post a Comment

Your feedback is highly appreciated and will help us to improve. So, please give your good suggestions.

Previous Post Next Post