VIVA QUESTIONS Part 1
VIVA QUESTIONS Part 1
1) What is C language?
C is a mid-level and procedural programming language. The Procedural programming language is also
known as the structured programming language is a technique in which large programs are broken down
into smaller modules, and each module uses structured code. This technique minimizes error and
misinterpretation.
C is known as a mother language because most of the compilers and JVMs are written in C language.
Most of the languages which are developed after C language has borrowed heavily from it like C++,
Python, Rust, javascript, etc. It introduces new core concepts like arrays, functions, file handling which
are used in these languages.
C is called a mid-level programming language because it binds the low level and high -level
programming language. We can use C language as a System programming to develop the operating
system as well as an Application programming to generate menu driven customer driven billing system.
Dennis Ritchie.
A loop running continuously for an indefinite number of times is called the infinite loop.
2. What do you mean by the Scope of the variable? What is the scope of the variables in C?
Ans: Scope of the variable can be defined as the part of the code area where the variables declared in the
program can be accessed directly. In C, all identifiers are lexically (or statically) scoped.
3. Suppose a global variable and local variable have the same name. Is it is possible to access a
global variable from a block where local variables are defined?
Ans: No. It is not possible in C. It is always the most local variable that gets preference.
Ans: The variables and functions that are declared using the keyword Static are considered as Static
Variable and Static Functions. The variables declared using Static keyword will have their scope
restricted to the function in which they are declared.
1. What are the valid places where the programmer can apply Break Control Statement?
Ans: Break Control statement is valid to be used inside a loop and Switch control statements.
Ans: To store a negative integer, we need to follow the following steps. Calculate the two’s complement
of the same positive integer.
Ans: The Parameters which are sent from main function to the subdivided function are called as Actual
Parameters and the parameters which are declared a the Subdivided function end are called as Formal
Parameters.
Ans: The program will be compiled but will not be executed. To execute any C program, main() is
required.
Ans: When a data member of one structure is referred by the data member of another function, then the
structure is called a Nested Structure.
VIVA QUESTIONS
1. What is a C Token?
2. What is Preprocessor?
Ans: A Preprocessor Directive is considered as a built-in predefined function or macro that acts as a
directive to the compiler and it gets executed before the actual C Program is executed.
Ans: C introduced many core concepts and data structures like arrays, lists, functions, strings, etc.
Many languages designed after C are designed on the basis of C Language. Hence, it is considered as the
mother of all languages.
Faster
Pointers
Recursion
Structured Language
Rich Library
Ans: printf() is used to print the values on the screen. To print certain values, and on the other
hand, scanf() is used to scan the values. We need an appropriate datatype format specifier for both
printing and scanning purposes.
VIVA QUESTIONS
1. What is an array?
Ans. The array is a simple data structure that stores multiple elements of the same datatype in a reserved
and sequential manner. There are three types of arrays, namely,
2. What is /0 character?
Ans: The Symbol mentioned is called a Null Character. It is considered as the terminating character
used in strings to notify the end of the string to the compiler.
3. What is the main difference between the Compiler and the Interpreter?
Ans: Compiler is used in C Language and it translates the complete code into the Machine Code in one
shot. On the other hand, Interpreter is used in Java Programming Langauge and other high-end
programming languages. It is designed to compile code in line by line fashion.
Ans: No, Integer datatype will support the range between -32768 and 32767. Any value exceeding that
will not be stored. We can either use float or long int.
Function_Body;
}
VIVA QUESTIONS
Ans: Dynamic Memory Allocation is the process of allocating memory to the program and its variables in
runtime. Dynamic Memory Allocation process involves three functions for allocating memory and one
function to free the used memory.
Ans: A Pointer in C Programming is used to point the memory location of an existing variable. In case if
that particular variable is deleted and the Pointer is still pointing to the same memory location, then that
particular pointer variable is called as a Dangling Pointer Variable.
Ans: Structure is defined as a user-defined data type that is designed to store multiple data members of
the different data types as a single unit. A structure will consume the memory equal to the summation of
all the data members.
Ans:
Actual arguments cannot be changed and Operations are performed on actual arguments,
Safety
remain safe hence not safe
Memory Separate memory locations are created for Actual and Formal arguments share the same
Location actual and formal arguments memory space.
Arguments Copy of actual arguments are sent Actual arguments are passed
VIVA QUESTIONS
Ans: Both the functions are designed to read characters from the keyboard and the only difference is that
getch(): reads characters from the keyboard but it does not use any buffers. Hence, data is not displayed
on the screen.
getche(): reads characters from the keyboard and it uses a buffer. Hence, data is displayed on the screen.
Ans. toupper() is a function designed to convert lowercase words/characters into upper case.
Ans: It is possible to create a new header file. Create a file with function prototypes that need to be used
in the program. Include the file in the ‘#include’ section in its name.
Ans: Memory Leak can be defined as a situation where programmer allocates dynamic memory to the
program but fails to free or delete the used memory after the completion of the code. This is harmful if
daemons and servers are included in the program.
Ans: A local static variable is a variable whose life doesn’t end with a function call where it is declared. It
extends for the lifetime of the complete program. All calls to the function share the same copy of local
static variables.
VIVA QUESTIONS
1. What is the difference between declaring a header file with < > and ” “?
Ans: If the Header File is declared using < > then the compiler searches for the header file within the
Built-in Path. If the Header File is declared using ” ” then the compiler will search for the Header File in
the current working directory and if not found then it searches for the file in other locations.
Ans: We use Register Storage Specifier if a certain variable is used very frequently. This helps the
compiler to locate the variable as the variable will be declared in one of the CPU registers.
Ans: x++; is the most efficient statement as it just a single instruction to the compiler while the other is
not.
4. Can I declare the same variable name to the variables which have different scopes?
Ans: Yes, Same variable name can be declared to the variables with different variable scopes
5. Which variable can be used to access Union data members if the Union variable is declared as a
pointer variable?
Ans: Arrow Operator( -> ) can be used to access the data members of a Union if the Union Variable is
declared as a pointer variable.