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 .
Table of Contents
Module 1 : Introduction (C Programming viva questions)
No. | Question and Answers |
---|---|
1 | What are the components of a computer system? |
Answer | The components of a computer system include the central processing unit (CPU), memory, input devices, output devices, and storage devices. |
2 | What is an algorithm? |
Answer | An algorithm is a step-by-step procedure or set of rules for solving a specific problem. |
3 | What is a flowchart? |
Answer | A flowchart is a graphical representation of the steps or actions involved in solving a problem or completing a process. |
4 | What are keywords in C programming? |
Answer | Keywords are reserved words in the C programming language that have predefined meanings and cannot be used as variable names or identifiers. |
5 | What are identifiers in C programming? |
Answer | Identifiers are names given to variables, functions, or other entities in a C program. |
6 | What are constants in C programming? |
Answer | Constants are fixed values that do not change during the execution of a program. |
7 | What are variables in C programming? |
Answer | Variables are memory locations used to store values that can be modified during the execution of a program. |
8 | What are the different data types in C programming? |
Answer | The data types in C programming include integer, float, character, and void, among others. |
9 | What are operators in C programming? |
Answer | Operators are symbols or characters that perform various operations on operands, such as arithmetic, logical, and relational operations. |
10 | How do you perform basic input and output operations in C? |
Answer | Basic input and output operations in C are performed using functions like scanf() and printf(). |
11 | What are expressions in C programming? |
Answer | Expressions are combinations of variables, constants, and operators that evaluate to a single value. |
12 | What is the precedence of operators in C? |
Answer | The precedence of operators determines the order in which operators are evaluated in an expression. |
13 | What are in-built functions in C? |
Answer | In-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) |
---|---|
1 | What are control structures in programming? |
A1 | Control structures are statements or constructs that control the flow of execution in a program. |
2 | What are the branching and looping structures in C? |
A2 | Branching structures include if, if-else, nested if-else, and else-if ladder statements. Looping structures include for loop, while loop, and do-while loop. |
3 | How does the if statement work in C? |
A3 | The 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. |
4 | What is the purpose of the switch statement in C? |
A4 | The switch statement is used to select one of many code blocks to be executed, based on the value of a variable or expression. |
5 | How do for, while, and do-while loops work in C? |
A5 | The 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. |
6 | What is the purpose of the break statement in C? |
A6 | The break statement is used to exit a loop or switch statement prematurely. |
7 | What is the purpose of the continue statement in C? |
A7 | The continue statement is used to skip the remaining code in a loop and move to the next iteration. |
(C Programming viva questions)
8 | What are the different types of loops in C? |
A8 | C 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. |
9 | What are nested control structures in programming? |
A9 | Nested 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. |
10 | What is the difference between the while loop and the do-while loop in C? |
A10 | The 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) |
---|---|
1 | What is a function in C programming? |
A1 | A 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. |
2 | What is a function prototype? |
A2 | A function prototype is a declaration that provides the function’s name, return type, and parameter types to the compiler before the function definition. |
3 | How do you define a function in C? |
A3 | A 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. |
4 | How do you access a function in C? |
A4 | A 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. |
5 | What is parameter passing in functions? |
A5 | Parameter 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. |
6 | What is recursion in C? |
A6 | Recursion 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) |
---|---|
1 | What is an array in C? |
A1 | An array is a collection of elements of the same data type, stored in contiguous memory locations, and accessed using an index. |
2 | How do you declare and initialize a one-dimensional array in C? |
A2 | An 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. |
3 | How do you declare and initialize a two-dimensional array in C? |
A3 | A 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. |
4 | What is a string in C? |
A4 | A string is an array of characters terminated by a null character (‘\0’). |
5 | How do you define and initialize a string in C? |
A5 | A string can be defined as an array of characters and initialized by enclosing the characters within double quotes. |
6 | What are string functions in C? |
A6 | String functions are predefined functions in C that perform operations on strings, such as copying, concatenating, comparing, and searching. |
7 | How do you access elements in an array in C? |
A7 | Elements in an array are accessed by using the array name followed by the index of the element within square brackets. |
8 | What is the difference between an array and a pointer in C? |
A8 | An 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. |
9 | Can an array be resized in C? |
A9 | No, 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. |
10 | What is the maximum number of elements an array can hold in C? |
A10 | The 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) |
---|---|
1 | What is the concept of structure and union in C? |
A1 | Structures and unions are user-defined data types in C that allow you to combine different data types under a single name. |
2 | How do you declare and initialize a structure in C? |
A2 | A structure is declared by specifying its members and their data types. Initialization involves assigning values to the members using the dot operator. |
3 | What are nested structures in C? |
A3 | Nested structures are structures that are members of another structure. They allow you to create complex data structures by combining multiple structures. |
4 | How do you declare and access an array of structures in C? |
A4 | An 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. |
5 | How do you pass a structure to a function in C? |
A5 | A 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. |
6 | What is the difference between a structure and a union in C? |
A6 | The 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. |
7 | How do you access members of a structure in C? |
A7 | Members 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”. |
8 | What is the purpose of typedef in C structures? |
A8 | The 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. |
9 | Can structures contain functions in C? |
A9 | No, structures in C cannot directly contain functions. However, they can have function pointers as members, which can be used to indirectly call functions. |
10 | What is the size of a structure in C? |
A10 | The 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) |
---|---|
1 | What are pointers in C? |
A1 | Pointers are variables that store memory addresses. They allow you to indirectly access and manipulate data in memory. |
2 | How do you declare, initialize, and dereference pointers in C? |
A2 | Pointers are declared by specifying the data type they point to, initialized by assigning the address of a variable, and dereferenced using the dereference operator (*). |
3 | What operations can be performed on pointers in C? |
A3 | Pointers 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. |
4 | What is dynamic memory allocation in C? |
A4 | Dynamic memory allocation in C allows you to allocate and deallocate memory at runtime using functions like malloc(), calloc(), realloc(), and free(). |
5 | What is the difference between pointers and arrays in C? |
A5 | Pointers 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. |
6 | How do you pass pointers to functions in C? |
A6 | Pointers 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. |
7 | What are null pointers in C? |
A7 | Null 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. |
8 | What is pointer arithmetic in C? |
A8 | Pointer 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. |
9 | What are function pointers in C? |
A9 | Function 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. |
10 | How do you allocate and deallocate memory using malloc() and free() in C? |
A10 | Memory 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. |
11 | What is the purpose of the const keyword with pointers in C? |
A11 | The 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. |
12 | What are void pointers in C? |
A12 | Void 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. |
13 | What is the difference between pass by value and pass by reference in C? |
A13 | Pass 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:
- 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.
- Practice with sample questions: we provided you viva questions try to practice those.
- Seek clarification: If you encounter doubts while preparing, don’t hesitate to seek clarification from your professors, friends, or online resources.
- 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.
Conclusion
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 :
https://www.w3schools.com/c/