c programming viva questions

Welcome to our comprehensive guide on module-wise C Programming viva questions for first-year engineering students. To help you excel in your viva examination, we have curated a set of questions organized by modules. Each module focuses on specific C programming concepts as per Mumbai University Syllabus , enabling you to prepare at last moment and have a practice .

Module 1 : Introduction (C Programming viva questions)

No.Question and Answers
1What are the components of a computer system?
AnswerThe components of a computer system include the central processing unit (CPU), memory, input devices, output devices, and storage devices.
2What is an algorithm?
AnswerAn algorithm is a step-by-step procedure or set of rules for solving a specific problem.
3What is a flowchart?
AnswerA flowchart is a graphical representation of the steps or actions involved in solving a problem or completing a process.
4What are keywords in C programming?
AnswerKeywords are reserved words in the C programming language that have predefined meanings and cannot be used as variable names or identifiers.
5What are identifiers in C programming?
AnswerIdentifiers are names given to variables, functions, or other entities in a C program.
6What are constants in C programming?
AnswerConstants are fixed values that do not change during the execution of a program.
7What are variables in C programming?
AnswerVariables are memory locations used to store values that can be modified during the execution of a program.
8What are the different data types in C programming?
AnswerThe data types in C programming include integer, float, character, and void, among others.
9What are operators in C programming?
AnswerOperators are symbols or characters that perform various operations on operands, such as arithmetic, logical, and relational operations.
10How do you perform basic input and output operations in C?
AnswerBasic input and output operations in C are performed using functions like scanf() and printf().
11What are expressions in C programming?
AnswerExpressions are combinations of variables, constants, and operators that evaluate to a single value.
12What is the precedence of operators in C?
AnswerThe precedence of operators determines the order in which operators are evaluated in an expression.
13What are in-built functions in C?
AnswerIn-built functions are pre-defined functions provided by the C language that perform specific tasks.

(C Programming viva questions)

Module 2 : Control Structures

No.Question and Answer (C Programming viva questions)
1What are control structures in programming?
A1Control structures are statements or constructs that control the flow of execution in a program.
2What are the branching and looping structures in C?
A2Branching structures include if, if-else, nested if-else, and else-if ladder statements. Looping structures include for loop, while loop, and do-while loop.
3How does the if statement work in C?
A3The if statement is used to execute a block of code if a specified condition is true. If the condition is false, the code block is skipped.
4What is the purpose of the switch statement in C?
A4The switch statement is used to select one of many code blocks to be executed, based on the value of a variable or expression.
5How do for, while, and do-while loops work in C?
A5The for loop executes a block of code repeatedly until a specified condition is met. The while loop and do-while loop also repeat a block of code based on a condition, but with different control structures.
6What is the purpose of the break statement in C?
A6The break statement is used to exit a loop or switch statement prematurely.
7What is the purpose of the continue statement in C?
A7The continue statement is used to skip the remaining code in a loop and move to the next iteration.

(C Programming viva questions)

8What are the different types of loops in C?
A8C programming language supports three types of loops: the for loop, the while loop, and the do-while loop. Each loop has its own syntax and specific use cases.
9What are nested control structures in programming?
A9Nested control structures refer to the use of one control structure inside another. This can be done by placing one control structure’s block of code within another control structure’s block. It allows for more complex program flow and decision-making.
10What is the difference between the while loop and the do-while loop in C?
A10The while loop checks the condition before executing the code block, while the do-while loop checks the condition after executing the code block. This means that the do-while loop will always execute the code block at least once, even if the condition is initially false.

Module 3: Functions

No.Question and Answer (C Programming viva questions)
1What is a function in C programming?
A1A function is a block of code that performs a specific task. It can be called from other parts of the program to execute the code within the function.
2What is a function prototype?
A2A function prototype is a declaration that provides the function’s name, return type, and parameter types to the compiler before the function definition.
3How do you define a function in C?
A3A function definition specifies the code to be executed when the function is called. It includes the return type, function name, parameters (if any), and the code block.
4How do you access a function in C?
A4A function can be accessed or called by its name followed by parentheses, and arguments can be passed within the parentheses if the function has parameters.
5What is parameter passing in functions?
A5Parameter passing is the mechanism of passing values to a function’s parameters when the function is called, allowing the function to work with the provided data.
6What is recursion in C?
A6Recursion is a programming technique where a function calls itself directly or indirectly to solve a problem by breaking it into smaller subproblems.

(C Programming viva questions)

Module 4: Arrays and Strings

No.Question and Answer (C Programming viva questions)
1What is an array in C?
A1An array is a collection of elements of the same data type, stored in contiguous memory locations, and accessed using an index.
2How do you declare and initialize a one-dimensional array in C?
A2An array is declared by specifying the data type of its elements and its size within square brackets. Initialization involves assigning initial values to the array elements.
3How do you declare and initialize a two-dimensional array in C?
A3A two-dimensional array is declared by specifying the data type of its elements and the number of rows and columns. Initialization involves assigning values to the array elements using nested braces.
4What is a string in C?
A4A string is an array of characters terminated by a null character (‘\0’).
5How do you define and initialize a string in C?
A5A string can be defined as an array of characters and initialized by enclosing the characters within double quotes.
6What are string functions in C?
A6String functions are predefined functions in C that perform operations on strings, such as copying, concatenating, comparing, and searching.
7How do you access elements in an array in C?
A7Elements in an array are accessed by using the array name followed by the index of the element within square brackets.
8What is the difference between an array and a pointer in C?
A8An array is a collection of elements, whereas a pointer is a variable that stores the memory address of another variable. However, there are similarities between arrays and pointers in C.
9Can an array be resized in C?
A9No, the size of an array in C is fixed at the time of declaration and cannot be changed during runtime. If resizing is required, dynamic memory allocation can be used.
10What is the maximum number of elements an array can hold in C?
A10The maximum number of elements an array can hold in C depends on the data type and the available memory in the system.

(C Programming viva questions)

Module 5: Structure and Union

No.Question and Answer (C Programming viva questions)
1What is the concept of structure and union in C?
A1Structures and unions are user-defined data types in C that allow you to combine different data types under a single name.
2How do you declare and initialize a structure in C?
A2A structure is declared by specifying its members and their data types. Initialization involves assigning values to the members using the dot operator.
3What are nested structures in C?
A3Nested structures are structures that are members of another structure. They allow you to create complex data structures by combining multiple structures.
4How do you declare and access an array of structures in C?
A4An array of structures is declared by specifying the structure type and the size of the array. Each element of the array can be accessed using the array index and the dot operator.
5How do you pass a structure to a function in C?
A5A structure can be passed to a function as a parameter by value or by reference. By value means a copy of the structure is passed, while by reference means the function receives the address of the structure.
6What is the difference between a structure and a union in C?
A6The main difference between a structure and a union in C is how they allocate memory. In a structure, each member has its own memory space, while in a union, all members share the same memory space. Additionally, a union can only store one value at a time, while a structure can store multiple values simultaneously.
7How do you access members of a structure in C?
A7Members of a structure can be accessed using the dot operator (.) followed by the member name. For example, if “struct_name” is a structure and “member_name” is a member of that structure, you can access it as “struct_name.member_name”.
8What is the purpose of typedef in C structures?
A8The typedef keyword in C is used to create a new name for an existing data type, including structures. It provides a convenient way to define complex data types and make the code more readable.
9Can structures contain functions in C?
A9No, structures in C cannot directly contain functions. However, they can have function pointers as members, which can be used to indirectly call functions.
10What is the size of a structure in C?
A10The size of a structure in C is determined by the sum of the sizes of its members, with possible padding added for alignment purposes. The sizeof operator can be used to determine the size of a structure.

(C Programming viva questions)

Module 6: Pointers

No.Question and Answer (C Programming viva questions)
1What are pointers in C?
A1Pointers are variables that store memory addresses. They allow you to indirectly access and manipulate data in memory.
2How do you declare, initialize, and dereference pointers in C?
A2Pointers are declared by specifying the data type they point to, initialized by assigning the address of a variable, and dereferenced using the dereference operator (*).
3What operations can be performed on pointers in C?
A3Pointers can be incremented or decremented, compared for equality or inequality, and assigned new addresses. They can also be used to access and modify the value they point to.
4What is dynamic memory allocation in C?
A4Dynamic memory allocation in C allows you to allocate and deallocate memory at runtime using functions like malloc(), calloc(), realloc(), and free().
5What is the difference between pointers and arrays in C?
A5Pointers and arrays in C are closely related, and in many cases, arrays are implemented using pointers. However, pointers and arrays have some differences, such as how they are declared, accessed, and used in different contexts.
6How do you pass pointers to functions in C?
A6Pointers can be passed to functions in C by specifying the pointer type as a parameter. The function can then access and modify the data pointed to by the pointer.
7What are null pointers in C?
A7Null pointers in C are pointers that do not point to any valid memory address. They are typically used to indicate the absence of a meaningful value or to initialize pointers before assigning them valid addresses.
8What is pointer arithmetic in C?
A8Pointer arithmetic in C allows you to perform arithmetic operations, such as addition, subtraction, and comparison, on pointers. It is often used to navigate through arrays or dynamically allocated memory.
9What are function pointers in C?
A9Function pointers in C are pointers that store the memory address of functions. They can be used to indirectly call functions or to store different functions as values in data structures.
10How do you allocate and deallocate memory using malloc() and free() in C?
A10Memory allocation in C can be done using the malloc() function, which dynamically allocates a specified amount of memory, and deallocation is done using the free() function to release the allocated memory.
11What is the purpose of the const keyword with pointers in C?
A11The const keyword in C can be used with pointers to declare that the value pointed to by the pointer is constant and cannot be modified through that pointer. It allows for safer and more controlled usage of pointers.
12What are void pointers in C?
A12Void pointers in C are pointers that have no associated data type. They can be used to store addresses of objects of any type, but they require explicit typecasting before they can be dereferenced.
13What is the difference between pass by value and pass by reference in C?
A13Pass by value in C involves making a copy of the value being passed to a function, while pass by reference involves passing the address of the value to the function. Changes made to

(C Programming viva questions)

Tips for a Successful Viva Examination

Preparing for a viva examination (C Programming viva questions) can be overwhelming, but with these tips, you can increase your chances of success:

  1. Thoroughly revise the fundamentals: Ensure you have a strong grasp of basic C programming concepts, including data types, control statements, functions, arrays, strings, structures, and file handling.
  1. Practice with sample questions: we provided you viva questions try to practice those.
  2. Seek clarification: If you encounter doubts while preparing, don’t hesitate to seek clarification from your professors, friends, or online resources.
  3. Stay calm and composed: During the viva, remain calm and composed. Take a moment to think before answering, and if you don’t know an answer, be honest and express your willingness to learn.


Congratulations! You have now gained a comprehensive understanding of C programming viva questions. By preparing with this guide, you will be well-equipped to tackle your viva examination with confidence. Remember to revise the important topics, practice answering questions, and stay composed during the examination. With dedication and thorough preparation, you can excel in your viva and achieve the desired outcomes.

Now, go ahead and ace that viva examination! Best of luck!

References :