0% found this document useful (0 votes)
136 views8 pages

VIVA QUESTIONS Part 1

C is known as a mother language because it introduced core concepts like arrays, functions, and file handling that were adopted by many other languages developed after C like C++, Python, and JavaScript. C is called a mid-level programming language because it can be used for both low-level system programming to develop operating systems as well as high-level application programming. Dennis Ritchie developed C language in 1972 at Bell Laboratories of AT&T.

Uploaded by

Shibu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views8 pages

VIVA QUESTIONS Part 1

C is known as a mother language because it introduced core concepts like arrays, functions, and file handling that were adopted by many other languages developed after C like C++, Python, and JavaScript. C is called a mid-level programming language because it can be used for both low-level system programming to develop operating systems as well as high-level application programming. Dennis Ritchie developed C language in 1972 at Bell Laboratories of AT&T.

Uploaded by

Shibu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

VIVA QUESTIONS

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. 

2) Why is C known as a mother language?

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.

3) Why is C called a mid-level programming language?

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. 

4) Who is the founder of C language?

Dennis Ritchie.

5) When was C language developed?

C language was developed in 1972 at bell laboratories of AT&T. More details.


VIVA QUESTIONS

1. What is an infinite loop?

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.

4. What are static variables and functions?

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.

 5. Differentiate between calloc() and malloc()

Ans: calloc() and malloc() are memory dynamic memory allocating functions. The only difference


between them is that calloc() will load all the assigned memory locations with value 0 but malloc() will
not.
VIVA QUESTIONS

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.

2. How can we store a negative integer?

Ans: To store a negative integer, we need to follow the following steps. Calculate the two’s complement
of the same positive integer.

Eg: 1011 (-5)

Step-1 − One’s complement of 5: 1010

Step-2 − Add 1 to above, giving 1011, which is -5

3. Differentiate between Actual Parameters and Formal Parameters.

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.

4. Can a C program be compiled or executed in the absence of a main()?

Ans: The program will be compiled but will not be executed. To execute any C program, main() is
required.

5. What do you mean by a Nested Structure?

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?

Ans: Keywords, Constants, Special Symbols, Strings, Operators, Identifiers used in C program are


referred to as C Tokens.

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.

3. Why is C called the Mother of all Languages?

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.

4. Mention the features of C Programming Language.

Ans:  Memory Management

Faster

Pointers

Recursion

High Level Language

Structured Language

Rich Library

5. What is the purpose of printf() and scanf() in C Program?

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,

 One Dimensional Array


 Two Dimensional Array
 Multi-Dimensional Array

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.

4. Can I use int datatype to store 32768 value?

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.

5. How is a Function declared in C Language?

Ans: A function in C language is declared as follows,

return_type function_name(formal parameter list)

      Function_Body;

}
VIVA QUESTIONS

1. What is Dynamic Memory allocation?

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.

malloc() – Allocates memory

calloc() – Allocates memory

realloc() – Allocates memory

free() – Deallocates the used memory

2. What do you mean by Dangling Pointer Variable in C Programming?

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.

 3. Where can we not use &(address operator in C)?

Ans: We cannot use & on constants and on a variable which is declared using the register storage class.

4. Write a simple example of a structure in C Language

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.

5. Differentiate between call by value and call by reference.

Ans:

Factor Call by Value Call by Reference

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

1. Differentiate between getch() and getche().

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.

2. Explain toupper() with an example.

Ans. toupper() is a function designed to convert lowercase words/characters into upper case.

3. Can I create a customized Head File in C language?

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.

4. What do you mean by Memory Leak?

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.

5. Explain Local Static Variables and what is their use?

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.

2. When should we use the register storage specifier?

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.

3. Which statement is efficient and why? x=x+1; or x++; ?

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.

You might also like