C Programming Viva Questions (Module-wise)
MODULE 1 — Basics of Computer & C Introduction
• What is a computer? — A machine that processes data and produces output.
• What is C language? — A structured procedural programming language.
• What is main()? — Entry point of every C program.
• What is a compiler? — Converts C code into machine code.
• What is a variable? — Named memory location to store data.
• What is a constant? — Value that cannot change.
• What is a data type? — Specifies type of stored data.
• What is printf()? — Used for output.
• What is scanf()? — Used for input.
• What is a header file? — File containing function declarations.
• What symbol ends a statement? — Semicolon ;
• What is the C source file extension? — .c
• What is compilation? — Converting source code to executable.
• What is algorithm? — Step■by■step problem solution.
• What are input devices? — Keyboard, mouse etc.
• What are output devices? — Monitor, printer etc.
• What is stdio.h? — Standard input/output header.
• What is executable file? — Compiled runnable program.
• What is syntax? — Rules of writing program.
• What is debugging? — Finding and fixing errors.
MODULE 2 — Operators, Decisions, Loops
• What is an operator? — Symbol performing operation.
• Arithmetic operators? — + - * / %
• Relational operator example? — > < ==
• Logical operators? — && || !
• What is assignment operator? — =
• What is typecasting? — Converting data type.
• What is if statement? — Decision making statement.
• What is if■else? — Chooses between two blocks.
• What is nested if? — If inside another if.
• What is switch? — Multi■choice decision.
• What is loop? — Repeats statements.
• Types of loops? — for, while, do■while.
• What is for loop? — Loop with init, condition, update.
• What is while loop? — Checks condition first.
• What is do■while? — Executes at least once.
• What is break? — Stops loop.
• What is continue? — Skips iteration.
• What is goto? — Jumps to label.
• What is infinite loop? — Loop that never stops.
• What is condition? — Expression returning true/false.
MODULE 3 — Functions & Arrays
• What is a function? — Reusable code block.
• Why use functions? — Reduce repetition.
• What is function declaration? — Prototype info.
• What is function call? — Invoking function.
• What is return statement? — Sends value back.
• What is parameter? — Function input.
• What is recursion? — Function calling itself.
• What is local variable? — Declared inside function.
• What is global variable? — Declared outside.
• What is array? — Collection of same type values.
• Array index starts from? — 0
• Declare array? — int a[10];
• What is 2D array? — Rows and columns array.
• Example 2D array? — int a[3][3];
• Can arrays be passed to functions? — Yes.
• What is array traversal? — Accessing elements.
• What is array size? — Number of elements.
• Mixed types in array? — No.
• Array memory allocation? — Continuous.
• What is array overflow? — Access beyond size.
MODULE 4 — Strings & Pointers
• What is string? — Character array ending with \0.
• Declare string? — char s[20];
• Find string length? — strlen()
• Copy string? — strcpy()
• Compare strings? — strcmp()
• Concatenate strings? — strcat()
• What is pointer? — Stores address.
• Pointer symbol? — *
• Address operator? — &
• Pointer declaration? — int *p;
• What is NULL pointer? — Points to nothing.
• What is pointer arithmetic? — Address operations.
• Generic pointer? — void *
• Dereferencing pointer? — Using *p.
• Pointer to pointer? — Address of pointer.
• Why use pointers? — Efficient memory use.
• Pointers in functions? — For call by reference.
• String stored as? — Character array.
• What is array of strings? — Multiple strings.
• What is memory address? — Location in RAM.
MODULE 5 — Structures, Unions, Files
• What is structure? — User■defined grouped variables.
• Structure keyword? — struct
• Access member? — . operator
• Example declaration? — struct student s;
• Array of structures? — Multiple struct vars.
• Structure inside structure? — Allowed.
• What is union? — Shares same memory.
• Structure vs union? — Separate vs shared memory.
• What is file handling? — Reading/writing files.
• File pointer type? — FILE *
• Open file? — fopen()
• Close file? — fclose()
• Write file? — fprintf()
• Read file? — fscanf()
• What is EOF? — End of file.
• File modes? — r w a
• Append mode? — Adds at end.
• Why files used? — Permanent storage.
• If file not closed? — Data loss risk.
• What is binary file? — Machine format storage.