Get Latest Exam Updates, Free Study materials and Tips

C Programming Viva Questions

C Programming Viva Questions

1. Which type of language is C?

Ans- C is a high–level language and general-purpose structured programming language.

2. What is a compiler?

Ans- Compile is a software program that transfer program developed in a high-level language into executable object code.

3. What is an algorithm?

Ans- The approach or method that is used to solve the problem is called an algorithm.

4. What is a c token and types of c tokens?

Ans- The smallest individual units are known as C tokens. C has six types of tokens Keywords, Constants, Identifiers, Strings, Operators and Special symbols.

5. How many Keywords (reserve word)are in C?

Ans- There are 32 Keywords in the C language.

6. What is an identifier?

Ans- Identifiers are user-defined names given to variables, functions and arrays.

7. What are the Back Slash character constants or Escape sequence characters available in C?

Ans- Back Slash character constant are \t, \n, \0.

8. What is a variable?

Ans- Variables are user-defined names given to memory locations and are used to store values. A variable may have different values at different times during program execution.

9. What are the Data Types present in C?

Ans- Primary or Fundamental Data types (int, float, char), Derived Datatypes(arrays, pointers) and User-Defined data types(structures, unions, enum)

10. How to declare a variable?

Ans- The syntax for declaring variable isdata type variable_name-1, variable_name-2,….variable_name-n;

  • Example 1: int a, b;
  • Example 2: float p,q;

11.What is meant by initialization and how do we initialize a variable?

Ans- While declaring a variable assigning value is known as initialization. Variable can be initialized by using assignment operator (=).

12.How many types of operators or there in C?

Ans- C consist Arithmetic Operators (+, -, *, /,%), Relational Operators (<, <=, >, >=, !=), Logical Operators (&&, ||, !), Assignment Operators (=, +=, -=, *=, /=), Increment and Decrement Operators (++, –), Conditional Operator(?:), Bitwise Operators(<<, >>, ~, &, |, ^) and  Special Operators (. , ->, &, *, size of)

13. What is a Unary operator and what are the unary operators present in C?

Ans- An operator which takes only one operand is called a unary operator. C unary operators are Unary plus (+), Unary minus (-), Increment and Decrement operators (++,–), Address of operator (&), Value at operator (*), sizeof operator, ones complement operator (~)

14. What is the use of the modulus (%) operator?

Ans- The modulus operator produces the remainder of an integer division. It cannot be used on floating-point data

15. What is the use of printf and scanf functions in C?

Ans-Values of variables and results of expressions can be displayed on the screen using printf functions. Values to variables can be accepted through the keyboard using scanf function

16. Forms of IF statements?

Ans- Simple IF statement, IF-ELSE statement, NESTED IF-ELSE statement and ELSE IF ladder

17. Forms of IF statements?

Ans- Simple IF statement, IF-ELSE statement, NESTED IF-ELSE statement and ELSE IF ladder

18. What is a goto statement?

Ans- GOTO is an unconditional branching statement which transfers control to the specified label.

19. What is a loop?

Ans- Loop is a sequence of statements that runs repeatedly.

20. What are loop control statements in C?

Ans- While do-while and for.

21. What are sections present in for loop?

Ans- Initialization section, conditional section and increment/decrement section.

22. What is the use of break statements?

Ans- The break statement is used to exit from the loop.

23. What is an array?

Ans-The array is a collective name given to similar elements.

24. How can we initialize an array?

Ans- The initializer for an array is a comma-separated list of constant expressions enclosed in braces

 ( { } ). The initializer is preceded by an equal sign ( = ). You do not need to initialize all elements in an array.

25. What is the difference between normal variable and array variable?

Ans- A variable can store only one value at a time whereas an array variable can store several value at a time.

26. What are the types of Arrays?

Ans- A one-Dimensional array, Two-Dimensional array and Multi-Dimensional array

27. What is a character array?

Ans- An array which can store several characters is called character array

28. What is a function?

Ans- The function is a self-contained block of the statement which is used to perform a certain task

29. What are the types of functions?

Ans- C functions are divided into two categories user-defined function and built-in functions

30. Which are called built-in functions?

Ans- Printf, scanf, clrscr, gotoxy, string handling functions and file handling functions

31. What is a recursive function?

Ans- A function calling itself is called function recursion

32. How to pass an array to a function?

Ans- Arrays are passed to a function by sending its address

33. What is a pointer variable?

Ans- A pointer variable is a variable that can store the address of another variable

34. How can we store the address of a variable is a pointer?

Ans- By using the address of the operator we can store the address of a variable in a pointer

35. How many bytes does a pointer variable occupies in memory?

Ans- A pointer variable irrespective of its type it occupies two bytes in memory

36. What are storage classes available in C?

Ans- Auto, static, extern and register

37. What is a structure?

Ans- The structure is user-defined data typed. The structure is a collective name given to dissimilar elements

38. How to excess structure members?

Ans- Structure members can be accessed using the dot operator

39) What are the differences between structures and arrays?

Ans- Structures store dissimilar values whereas arrays stores similar values. One structure variable can be assigned to another structure variable whereas one array variable cannot be assigned to another array variable

40. What is the size of a structure?

Ans- Sum of all the members size is becomes structure size

41. What is a union?

Ans- Union is a user-defined data type that can store a value of different data types

42. What are the types of files we can create using C?

Ans-We can create text and binary files using C

43. What are the file-handling functions present in C?

Ans- fopen, fclose, fgetc, fputc, fgets, fputs, fprintf, fscanf, fread, fwrite, fseek

44. What are the file opening modes present in C?

Ans- r, w, a, r+, w+, a+, rb, wb, rb+, wb+

45. How to access structure members by their pointer?

Ans- We can use structure members using arrow operator with its pointer

46. What is the difference between normal variable and array variable?

Ans- A variable can store only one value at a time whereas an array variable can store several value at a time.

47. How to declare a variable?

Ans- The syntax for declaring the variable is

Datatype variable_name-1,variable_name-2…variable_name-n

Prepare For Your Placements: https://lastmomenttuitions.com/courses/placement-preparation/

/ Youtube Channel: https://www.youtube.com/channel/UCGFNZxMqKLsqWERX_N2f08Q

Follow For Latest Updates, Study Tips & More Content!

/lastmomenttuition

/ Last Moment Tuitions

/ lastmomentdost