Computer Programming Questions
Computer Programming Questions
1) What is C language?
C is a programming language developed at AT & T’s Bell Laboratories of USA in
1972.The C programming language is a standardized programming language
developed.
2) What is an algorithm?
An algorithm is a step-by-step method of performing any task.
3) What is a flow chart?
A flowchart is a type of diagram that represents an algorithm or process, showing the
steps as boxes of various kinds, and their order by connecting these with arrows.
4) What is a C Preprocessor?
C Preprocessor is a program that processes our source program before it is passed to
the compiler.
5) What is the use of header files as used in C programming?
Header files are used to have declarations.It is simple to include a single header file
than writing all the needed functions prototypes.
6) What is the Structure of a C Program?
Documentation Section
Linking Section
Definition Section
Global declaration Section
main function
subprogram section.
7) Explain some Header Files?
stdio.h This is standard i/o header file in which Input/Output functions are declared
conio.h This is console input/output header file
string.h All string related functions are defined in this header file
stdlib.h This header file contains general functions used in C programs
math.h All maths related functions are defined in this header file
8) What is the use of main() function?
main() is the starting point of program execution.
9) What are the types of constants in c?
C constants can be divided into two categories:
1. Primary constants (Numerical)
2. Secondary constants (Character)
10)What is a Compiler?
A compiler is a computer program that transforms source code written in a
programming language into another computer language
11)What is a Token in C?
A Token is the basic building block of a C.
C Tokens are:Key Words, Identifier, Constants, String – literal, Operator, Punctuators
12)What are Printf() and scanf() Functions :
printf() function is used to print the “character, string, float, integer, octal and
hexadecimal values” onto the output screen.
scanf() function is used to read character, string, numeric data from keyboard
13)What is a Data Type and List the different Data types?
C data types are defined as the data storage format that a variable can store a data to
perform a specific operation.
List of Data Types:
1. Basic Data Types: Int, Float, Char, Double, long int
2. Enumeration Data Type: enum
3. Derived Data Type: Pointer, array, structure, union
4. Void Data Type: void
14)What is Integer Data Type?
Integer data type allows a variable to store numeric values.
Arithmetic operators
Relational operators
Logical operators
Assignment operators
Increment and Decrement operators
Conditional operators
Bitwise operators
Special operators.
24)What are Special Operators?
&(Address Operator)
*(Pointer Operator)
Sizeof()
25)What is sizeof operator?
It returns the number of bytes the operand occupies.
26) What is pre-increment or post-increment?
++n (pre increment) increments n before its value is used in an assignment operation
or any expression containing it.
n++ (post increment) does increment after the value of n is used.
27)What is type casting?
Converting a variable of one type to another type.
28)What are the Format Specifiers or Type Specifiers or Conversion Specifiers?
%d (Integer)
%f (Float)
%c (Character)
%l (Long Integer)
%s (Strings)
%u (Address with decimal value)
%p (Address with Hexa Decimal Value in Small Letters)
%x ((Address with Hexa Decimal Value in Capital Letters)
29)What is a Statement in C?
A statement is a block of code that does something.
30)Different Types of Statements?
Null Statement
Expression Statement
Compound Statement
Return Statement
Conditional Statements
Iterative or Looping Statements
Unconditional Statements
31)What are different types of conditional statements?
If Statement
If else statement
Nested- if else statement
Switch Statement
32)What is Looping Statements?
Looping statement which executes the statements with in the compound statement by
checking the condition, and performs same set of statements as a loop until the
condition false.
Looping Statements are: While, do-while, for
33)What is the difference between for loop and while loop?
For Loop:execute a set of statements in fixed number of times.
While loop:when the number of iterations to be performed is not known in advance.
34)What are Unconditional Statements?
A pointer value is a data object that refers to a memory location. Each memory
location is numbered in the memory.
The number attached to a memory location is called the address of the location.
If a pointer variable points another pointer value. Such a situation is known as a
pointer to a pointer.
45) What are the Advantages of Functions?
Function declaration - This informs compiler about the function name, function
parameters and return value’s data type.
Function call – This calls the actual function
Function definition – This contains all the statements to be executed.
49)Define Call by Value and Call by Reference?
In call by value method, the value of the variable is passed to the function as
Parameter.
In call by reference method, the address of the variable is passed to the function as
parameter.
50) List some MATH.H Functions?
1. abs ( )
2. floor ( )
3. round.(.)
4. ceil ( )
5. sqrt ( )
6. pow ( )
7. trunc()