Showing posts with label Class Notes: C Programming. Show all posts
Showing posts with label Class Notes: C Programming. Show all posts

Explain the Basic Structure of a C Program with an Example.

Basic structure of C programming: 

To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are illustrated below.

Write down the commonly used scanf format codes?

Commonly used scanf format codes: 

In the following table the required format codes and their meanings are given.

Write down the character test functions and their tests.

Character Test Functions: 

In the following table the required functions and their tests are given.

In C language, define input & output operations and management of them.

Input & output operations: 

The operations which took place in order to take data and make the display of the processed information are known as input & output operations.

What are the rules for ++ and -- operators?

Rules for ++ and – operators: 

Following are the rules for the increment (++) and decrement (--) operators.

What are the different operators?

Arithmetic operators: 

The arithmetic operators are +, -, *, /. They work the same way as they do in other languages. There are three types of arithmetic operators which are as follows,

What is operator ? What are the categories of operators?


An operator is a symbol that tells the computer to perform certain mathematical and logical manipulations. Operators are used in programs to manipulate data and variables. Such as, ++, --, <, > etc.

What are the data types of C?

Data types:

C language is rich in its data types. ANSI supports three classes of data types.
  1. Primary or fundamental data types.
  2. Derived data types.
  3. User-defined data types.

What are variables? What are the conditions for variables?


A variable is a data name that may be used to store data value. A variable may take different value at different times during execution. Some examples are, average, height, class_strength.

What is keyword and identifier ? What are the rules for identifier?


Keywords have fixed meanings and these meanings can not be changed. There are 32 keywords. Some compiler may use additional keywords that must be identified from the C manual. Keywords serve as basic building block for a program statement.

Write shortly about the character set in C.

Character set:

The various category of characters are called the character set. In C, the characters are grouped into the following categories.

What is a constant? Write are the different type of constants in C language?

What is a Constant?

In C programming language and other languages, constants are variables with a exception that the value of a constant can be set only once and can not be modified later. This exception differs a constant variable from other variables and are called constant because their values are not variable. Value of a constant can not vary during the execution of a program, thus it can not be called a variable.

Using constants for unchangeable values ensure that the value remains the same over the period of execution, will not change mistakenly.
In programs which embeds third party codes or scripts, constants make sure that the value will not be changed by third party codes intentionally or mistakenly.

Define information, program, syntax rules or grammar and syntax errors.


After converting or processing the data which may consists of numbers, characters, strings etc to something which is useful and make much sense to a person is known as Information. So, information is the converted or processed form of data.

Write down about the else if ladder

The else if ladder :

When a multipath decision is involved then we use else if ladder. A multipath decision is a chain of ifs in which the statement associated with each else is an if. It takes the following general form,

Write down about the nested if-else statement

Nested if...else statement:

When a series of decisions are involved, we may have to use more than one if-else statement in nested form as shown below,

Write down about the if-else statement

The if-else statement : The general form of the if....else statement is as follows,

Write down about the simple if statement

Simple if statement : The general form of a simple if statement is as follows,

Write down about the decision making statement if.

The if statement : The if statement is a powerful decision making statement and is used to control the flow of execution of statements. It is basically a two way decision-statement. It takes the following form,

What is decision making? What are the statements used in C for decision making purpose?

Decision making : In practice, users may have a number of situations where they may have to change the order of statements based on certain conditions. This is decision making. The decision making statements in C are as follows

Draw the flowchart of a multifunction program

Multifunction program: A program, which has been written using a number of functions, is treated as a multifunction program. The flowchart of the flow of control in a multifunction program is as follows,