0% found this document useful (0 votes)
27 views3 pages

C Language Important Viva QA MSBT

The document contains important C language viva questions and answers organized into six units covering basics of C programming, control structures, arrays and structures, functions, pointers, and file handling. Key concepts include variables, constants, control flow statements, arrays, structures, functions, pointers, and file operations. Each unit provides definitions, explanations, and differences related to the topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

C Language Important Viva QA MSBT

The document contains important C language viva questions and answers organized into six units covering basics of C programming, control structures, arrays and structures, functions, pointers, and file handling. Key concepts include variables, constants, control flow statements, arrays, structures, functions, pointers, and file operations. Each unit provides definitions, explanations, and differences related to the topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Important C Language Viva Questions & Answers (MSBTE K Scheme)

Unit 1: Basics of C Programming

Q: What is a variable in C?

A: A variable is a name given to a memory location to store data. Its value can change during program execution.

Q: Define a constant in C.

A: A constant is a fixed value that cannot be changed during the execution of a program.

Q: What is the use of #include<stdio.h>?

A: It tells the compiler to include standard input-output functions before actual compilation.

Q: What are data types in C?

A: Data types define the type of data a variable can hold, e.g., int, float, char.

Q: What is the main() function?

A: It is the entry point of any C program.

Unit 2: Control Structures

Q: What are control structures?

A: They control the flow of execution, like if, if-else, switch, loops.

Q: Explain the if-else statement.

A: It allows conditional execution based on a condition.

Q: Syntax of switch statement?

A: switch(expression) { case value: ... break; default: ... }

Q: Difference between while and do-while?

A: while checks condition first; do-while executes at least once.

Q: What is the purpose of goto?

A: Transfers control to another part of the program using a label.


Important C Language Viva Questions & Answers (MSBTE K Scheme)

Unit 3: Arrays and Structures

Q: What is an array?

A: A collection of same-type elements in continuous memory.

Q: What is a string in C?

A: An array of characters ending with a null character '\0'.

Q: What is a structure?

A: A user-defined data type that groups variables of different types.

Q: Difference between array and structure?

A: Arrays store same-type data, structures can hold multiple types.

Q: How to access structure members?

A: Using dot (.) for variables, arrow (->) for pointers.

Unit 4: Functions

Q: What is a function?

A: A block of code that performs a specific task.

Q: Advantages of functions?

A: Code reusability, modularity, easier debugging.

Q: What is recursion?

A: A function calling itself.

Q: Difference between call by value and call by reference?

A: Call by value passes a copy; call by reference passes the address.

Q: What is a static function?

A: A function whose scope is limited to the file it is declared in.


Important C Language Viva Questions & Answers (MSBTE K Scheme)

Unit 5: Pointers

Q: What is a pointer?

A: A variable that stores the address of another variable.

Q: Use of & and *?

A: & gets the address; * accesses the value at the address.

Q: What is a null pointer?

A: A pointer that does not point to any memory location.

Q: What is a void pointer?

A: A pointer that can point to any data type.

Q: What is pointer arithmetic?

A: Performing operations like increment/decrement on pointers.

Unit 6: File Handling

Q: What is file handling in C?

A: Reading and writing data to files stored on disk.

Q: What is FILE in C?

A: A special data type used for file pointers.

Q: File modes in fopen()?

A: 'r', 'w', 'a', 'r+', 'w+', 'a+'.

Q: Functions used in file handling?

A: fopen(), fclose(), fscanf(), fprintf(), fgetc(), fputc().

Q: What does feof() do?

A: Checks if the end of the file has been reached.

You might also like