CP Lab Viva Questions
CP Lab Viva Questions
1. What is a computer?
2. Different types of components in computer.
3. How many different types of computer languages exists?
4. Difference between machine language and high-level language.
5. Steps involve in developing and executing a C program. (Ans. 6 steps. (edit,...,execute).
6. What is a compiler?
7. What is an interpreter?
8. Difference between compiler and interpreter.
9. What is algorithm, pseudocode and flowchart?
10. List and explain the flowchart symbols.
11. What is a variable?
12. What is an identifier?
13. What is a keyword? How many keywords are there in C language.
14. List any 10 keywords.
15. Rules for specifying an identifier.
16. How many types of data types are there ? (Ans: 3 [primary, derived and user-defined data
type]).
17. List primary data types. (Ans : int,float,char,double etc).
18. List derived data types. (Ans: array,string and pointer).
19. List user-defined data types. (Ans: structure,union and enum).
20. List all the arithmetic operators.
21. What is precedence and associativity of operators.
22. Explain precedence and associativity of arithmetic operators?
23. What is typecasting? (or- type conversion)
24. How many types of typecasting exists?
25. Explain with example the difference between implicit and explicit typecasting.
26. List the symbol of typecast operator.
UNIT - II
6. What is a function?
7. How many types of functions are there? (Ans: 2 predefined and user-defined)
8. What is pre-define and user-defined function?
9. List any 10 predefined function names.
(Ans : pow( ),sin( ),cos( ),tan( ),sqrt( ),strlen( ),strcpy( ),strcat( ),strcmp( ),exit( )).
10. How many parameter passing techniques are there?
11. Difference between call-by-value and call-by-reference technique.
12. What is recursion?
13. Difference between recursion and iteration. (Hint : explain with the help of factorial
program).
14. How many storage classes exists in C language?
15. What is the use storage classes? (Hint: Explain with the help of the table discussed for
storage class)
16. Explain the use of static storage class.
UNIT-III
1. What is an array?
2. Write the syntax for array declaration.
3. Explain the use of array with the help of an example array declaration.
4. How many searching techniques are there? (Ans: 2, linear search and binary search)
5. Explain the working of linear search.
6. Explain the working of binary search.
7. Which searching technique is efficient and why? ( Ans: Binary search, as it takes less
no.of comparisons to search an element)
8. What is the limitation of binary search? (Ans: works only on sorted arrays)
9. What is sorting? Name some different sorting techniques.
10. What is bubble sort? Explain its working.
11. Explain the working of selection sort.
12. What is the syntax for declaring a 2-D array? Explain with the help of example.
13. How much memory is allocated to array a, if it is declared as : int a[10][5];
14. Explain how a 2-D array can be initialized at the time of declaration. (Hint : comma
separated initializer-list)
15. Explain how an array can be passed to a function.
UNIT-IV
1. What is pointer? Explain how a pointer is declared and initialized.
2. What is the size of a pointer variable? (Ans: size of unsigned int)
3. Which conversion specifier is used to print the address and why? (ans: %u)
4. What is the use indirection operator?
5. What is a generic pointer? Can we dereference a generic pointer.
6. What is a null pointer?
7. What is a pointer to a pointer?
8. What are the operations valid on pointers.
9. Explain array of pointers with an example.
10. List the pre-defined functions used for dynamic memory allocation.
11. What are command-line arguments?
12. What is a string? Explain how a string can be declared.
13. What is the symbol of null character?
14. What is the difference between array of characters and strings?
15. Which conversion specifier is used to read and print a string.
16. What is the difference between gets( ) and scanf( ).
17. List any five predefined functions from string.h
UNIT-V
1. What is a structure? Give syntax for structure declaration.
2. Explain structure declaration with help of an example.
3. What is a pointer to a structure?
4. Explain the use of dot operator (.) and arrow operator (->).
5. What is a self-referential structure? Give example.
6. What is the use of “typedef” keyword.
7. What is a nested structure? Give an example.
8. Explain how a structure can be passed to a function.
9. What is a union? Give syntax for union declaration.
10. List the differences between structure and union.
11. What is enumeration? Give an example.
12. What is a file?
13. What is FILE? (Ans : a predefined structure in stdio.h. It helps to deal with files)
14. What is EOF?
15. Explain how a file can be opened. (Ans: using fopen( ) function)
16. Explain the value return from fopen( ).
17. What are the different modes in which a file can be opened?
18. What happens if we open an already existing file in a write (“w”) mode?
19. Explain the use of fscanf( ) and fgetc( ) functions.
20. Explain the use of fprintf( ) and fputc( ) functions.
21. What is the use of feof( ) function.
22. How can we close a file? (Ans: using fclose( ) function)