Question-Answer of C Programming

1. What is program? What are the different steps of program development?

Ans:program is a set of instructions that a computer follows in order to perform a particular task. Programs are created using specific programming languages such as C, C++, Java, Python etcA program is a set of instructions that process input, manipulate data, and output a result. For example, Microsoft Word is a word processing program that allows users to create and write documents.

Program development is the process of creating programsA program development process consists of various steps that are followed to develop a computer program. These steps are followed in a sequence in order to develop a successful and beneficial computer program. 

Following is a brief description of the program development process.

Analyze the problem: In this step, a programmer must figure out the problem, and then decide how to resolve the problem.

Design the program: The programmer designs an algorithm to help visual possible alternatives in a program also.

A flow chart is important to use during this step of the program development. This is a visual diagram of the flow containing the program. This step will help you break down the problem.

Code the program: This is using the language of programming to write the lines of code. The code is called the listing or the source code.

Debug the program: Debugging is a process of detecting, locating and correcting the bugs in a program. The bugs are important to find because this is known as errors in a program.

Formalize the solution: One must run the program to make sure there are no syntax and logic errors. Syntax are grammatical errors and logic errors are incorrect results.

Document and maintain the program: This step is the final step of gathering everything together. When the program is finalized, its documentation is prepared.

 

2.  What is algorithm? What are its various characteristics?

Ans: An algorithm is simply a set of steps used to complete a specific task. It is a finite set of instructions carried out in a specific order to perform a particular task.

Characteristics of an Algorithm:

An algorithm should have the following characteristics:

InputAn algorithm requires some input values. There should be zero or more inputs supplied externally to the algorithm.

OutputThere should be at least one output produced.

Definiteness or Unambiguity: Algorithm should be clear and unambiguous. Each of its steps should be clear and simple in all aspects and must lead to only one meaning.

Finiteness:  The algorithm must be finite. Here, finiteness means that the algorithm should contain a limited number of instructions. Algorithms must terminate after a finite number of steps.

Effectiveness: An algorithm should be effective as each instruction in an algorithm affects the overall process.. Every instruction must be basic and must be feasible.

 

3.   What is pre-processor directive? Why it is required?

Ans: The commands of the preprocessor are known as pre-processor directives. Preprocessor directive begin with a hash symbol (#).The # is followed by an identifier that is the directive name. For example, #define is the directive that defines a macro.

Some preprocessor directives are: #include, #define, #undef etc. It is placed before the main().

 

Preprocessor directives, such as #define and #ifdef, are typically used to make source programs easy to change and easy to compile in different execution environments. Directives in the source file tell the preprocessor to take specific actions. For example, the preprocessor can replace tokens in the text, insert the contents of other files into the source file, or suppress compilation of part of the file by removing sections of text.

 

4.  What is syntax error and semantic error? Write at least two differences between them.

5.    Explain different types of errors in C.

6.   What is the function of linker and loader? Explain.

7.    What are delimiters? Explain any two of them with their functions.

Ans: A delimiter is a unique character or series of characters that indicates the beginning or end of a specific statement, string or function body set.

Delimiters are used in programming languages to specify code set characters or data strings, serve as data and code boundaries and facilitate the interpretation of code and the segmentation of various implemented data sets and functions.

Programming languages use delimiters in different coding scenarios to determine specific type and instruction boundaries. Because delimiters – such as commas and full stops – define different condition types, the delimiter concept is very similar to the English language.

Delimiter examples include:

  • Round brackets or parentheses: ( )
  • Curly brackets: { }
  • Escape sequence or comments: /*
  • Double quotes for defining string literals: ” “

 

8.   Draw the basic structure of a C program.

9.   Briefly explain the general steps of writing a C program.

10.  State the series of steps for executing a program written in C.

11.What is compiler?

12. What is header file in C? List any two header files.

13.   What are library functions? Give example.

14.   What is the significance of stdio.h?

15.   What is the difference between “stdio.h”and “string.h”? Explain.

16.    What is the purpose of scanf() function?

17.     What is the difference between scanf()and gets().

18.    What is keyword in C?

19.   What is the use of %d in C?

20.  What is the use of t in C?

21.   Mention how to write a comment in C?

22.  What is source code?

Ans: Source code is the set of instructions a programmer writes using computer programming languages. This code is later translated into machine language by a compiler. Source code is the source of a computer program.

Leave a Comment