Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

C Programming VIVA Question and Answer

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

C Programming VIVA Question and Answer

1. What is Program?
A computer program is a collection of instructions that can be executed by
a computer to perform a specific task.

2. What is Algorithm?
Algorithm is a step-by-step procedure, which defines a set of instructions to be
executed in a certain order to get the desired output.

3. What is Flowchart?
Flowchart is a graphical representation of an algorithm are program.

4. What is Variables?
Variables are the names you give to computer memory locations which are used
to store values in a computer program.

5. What is Constant?
Data values that stay the same every time a program is executed are known
as constants.

6. What is Datatype?
Datatype determines the type and size of data associated with variables.

7. Basic Datatypes:
a. int - used to define numeric variables holding whole numbers.
b. Float - used to define numeric values with floating decimal points
c. char - used to store a single character.
d. Double - Double is more precise than float.
e. Void - void actually refers to an object that does not have a value of any type.

8. What is arrays?
Arrays a kind of data structure that can store a fixed-size sequential collection
of elements of the same type. 

9. What is main function?


The main function serves as the starting point for program execution.

10.What is default return type of main function?


Main function return type is integer by default.
11.What is #include?
#include is a way of including a standard or user-defined file in the program and
is mostly written at the beginning of any C program.

12.What is Conditional Statements?


Used to make decisions based on the conditions.
Ex: if, if else, nested else if.

13.What is if?
The if statement allows you to control if a program enters a section of code or
not based on whether a given condition is true or false.

14.What is if else?
 The if...else statement executes two different codes depending upon whether
the test expression is true or false.

15.What is switch?
The switch statement is a multiway branch statement. It provides an easy way
to dispatch execution to different parts of code based on the value.

16. What is break statement?


The break statement ends the loop immediately when it is encountered.

17.What is looping Statement?


Looping statement are the statements execute one or more statement repeatedly
several number of times.
Ex: while loop, do while loop, for loop.

18.What is while loop?


A while loop in C programming repeatedly executes a target statement as long
as a given condition is true.
While loop is entry controlled loop.

19.What is do while loop?


A do while loop is a control flow statement that executes a block of code at least
once, and then either repeatedly executes the block, or stops executing it,
depending on a given condition at the end of the block.

20.What is for loop?


A for loop is a repetition control structure that allows you to efficiently write
a loop that needs to execute a specific number of times.
21.What is function?
A function is a group of statements that together perform a task.

22.What is function Prototype or declaration?


A function prototype is simply the declaration of a function that specifies
function's name, parameters and return type.
It doesn't contain function body. A function prototype gives information to the
compiler that the function may later be used in the program.
Syntax: return type function name (argument list);

23.What is Function call?


Function call Function can be called from anywhere in the program. The parameter
list must not differ in function calling and function declaration. We must pass the
same number of functions as it is declared in the function declaration.
Syntax: function name (argument list)

24.What is Function definition?


Function definition It contains the actual statements which are to be executed.
It is the most important aspect to which the control comes when the function is
called. Here, we must notice that only one value can be returned from the
function.
Syntax: return type function name (argument list) {function body;}

25.Types of function?
Standard library functions: are the functions which are declared in the C
header files such as scanf (), printf (), gets (), puts () etc.
User-defined functions:  are the functions which are created by the C
programmer, so that he/she can use it many times. It reduces the complexity of a
big program and optimizes the code.

26.What is structure?
The structure is a user-defined data type in C, which is used to store a
collection of different kinds of data.

27.What is pointer?
A pointer is a variable whose value is the address of another variable.
Ex: int *p;
28.What is scanf?
The scanf () is one of the commonly used function to take input from the user.
The scanf () function reads formatted input from the standard input such as
keyboards.

29.What is printf?
The printf () is a library function to send formatted output to the screen. The
function prints the string inside quotations.

30.What is = and ==?


= operator is used to assign value to a variable.
== operator is used to compare two variable or constants.
The '==' operator checks whether the two given operands are equal or not.

31.Difference between ++i and i++?


++i first increment the value of variable by one and then it returns its value.
i++ first returns the value of variable then increments its value by 1.

32. || - Logical OR operators and && logical AND operator

33.What is computer?
A computer is an electronic device that manipulates information, or data. It has
the ability to store, retrieve, and process data.

34.What is software?
Software is a collection of instructions and data that tell a computer how to
work.

35.What is hardware?
Computer hardware is the collection of physical parts of a computer system.

36.Command for create a file:


gedit filename.c

37.Command for compiling a file:


cc filename.c
cc filename.c –lm (when we are using sqrt (), pow (), fabs () in the program)

38.Command for run the file:


./a.out

You might also like