You are on page 1of 4

Important question for viva

🧸🧸🧸🧸🧸🧸🧸🧸🧸

● What do you mean by header files?


● What is main()?
● What's the difference between int main() and void main()?
● What is a variable? What are the types of variables?
● What is the difference between local and global variables?
● What is the full form of printf and scanf?
● What do you mean by format specifiers?
● What is the size of 1 character?
● What is the difference between float and double?
● What are data type modifiers? (Short, long, long long, signed, unsigned) ● What are
the types of data types?
● Give examples of derived data types.
● What is an identifier?
● Can you start a variable name from a number?
● What is a compiler?
● Which compiler do you use to run your C programs?
● What is type casting? What are its types?
● How ternary operator is similar to if else statements?
● Name bitwise operators.
● What does the modulus operator do?
● What is the difference between = and == operator? ● Do we have string as a datatype
in C? No ● How can you print the size of a variable?
● How can you print the address of a variable?
● What do you mean by static variable?
● Can we declare two variables with the same name in different scopes? If yes, why?
● Can we pass float value to a switch statement?
● How does the switch statement work?
● What is the difference between break and continue statement?
● Explain the working of for loop.
● What's the difference between for, while, and do while loop?
● What is the difference between pre-increment operator and post-increment operator?
● What do you mean by keywords? How many keywords are there in C?
● How many header files are there in C? 29 ● In which situations a loop can run infinite
times?

● What are the types of input/output functions? Formatted and Unformatted ● What do
you mean by getch(), getche() and getchar()?
● What is the range of integers? Can I store a 10 digits contact number in an integer
variable? Explain.
● Write a program to print “Hello World” without using a semicolon.
Which data type would you use to store a 10 digit mobile number starting with digit 6
onwards? Give a reason.

● What is an Array? How do you create an array in a C program?


● What are advantages and disadvantages of an array?
● Can we change the size of an array during runtime? If no, Why?
● How to input elements in an array?
● Explain any one sorting algorithm to sort an array. Write a program to explain your
answer.
● Is there any difference between int[ ] a and int a[ ]?
● If you do not initialize an array, what will be the default value of elements?
● What is recursion?
● What are fibonacci numbers? Can you write the logic to print fibonacci numbers using
recursion?
● What is a palindrome string? How would you check whether a string is palindrome or
not?
● What is the base address?
● What is the size of a pointer? Why?
● What do you mean by string? Give an example.
● What is a 2-D array? Declare and initialize an array with 3 rows and 4 columns.
● How is an array name a constant pointer?
● Is it possible to compare two pointers? Why?
● WAP to print the following pattern:
*
**
***
****
● WAP to print the following pattern:
******
* *
* *
******
● Mention 5 functions of string manipulation.

● How does strcmp() work?


● What's the difference between formal arguments and actual arguments?
● What’s the difference between call by value and call by reference?
● Which functions can you use to input a string with whitespace?
● What’s the difference between gets() and fgets()?
● What's the difference between function declaration and function definition?
● Which inbuilt functions would you use to convert a string to uppercase and lowercase?
● Could you write a program to input a password using getch()?
● What do you mean by frequency of characters in a string? WAP to find the frequency of
character ‘l’ in the string “hello world”.
● How can you pass a string to a function?
● WAP to find the length of a string without using the inbuilt function.
WAP to read and print a string using a pointer.
● What is the difference between puts() and printf()?
● Mention the advantages and disadvantages of using recursive functions.
● If one of the elements of an array is initialised, what will be the value of other elements?
For example: int arr[6] = { 5 };

● What are storage classes in C?


● What do you mean by Null Pointer?
● What do you mean by dangling Pointer?
● What is a generic pointer?
● What do you mean by wild pointer?
● What is the difference between structure and array?
● What is DMA?
● What do you mean by malloc() and calloc()? What is the difference between them?
● Why do we need to typecast while calling malloc() and calloc()? Because malloc() and
calloc() both return void type of pointer.
● How do we calculate the size of a structure?
● Why are padding bytes added while calculating structure size? (To avoid data alignment
issues)
● Can we pass a structure to a function? If yes, give an example.
Yes, we can pass a structure variable to a function as an argument. For example,

void print_details(struct student s1)


{ printf("Your details are\n"); printf("Name = %s\n",s1.name); printf("UID =
%d\n",s1.uid); printf("Contact Number =%lld\n",s1.mobile_num);

printf("Date of Birth = %d.%d.%d\n", s1.dob.day, s1.dob.month,


s1.dob.year);
}
Here, the s1 structure variable is passed as an argument to a function.

● Can you define a structure without a name, for example the one mentioned below(YES)?
struct
{
int x; //member 1 char
arr[10]; //member 2
char z; //member 3
};

● What’s the difference between structure and union?


● Give examples of user-defined data types. (struct, union, enum types)
What do you mean by union?
● What do you mean by nested structures? Give an example.
● Which operators are used to access members of a structure?( Dot operator (.) and arrow
( -> ) operator)
● How do you access members of the structure?
(VariableName.memberName or VariableName->memberName if variable is of type of
pointer)
● How do you deallocate the memory at runtime? (using free() function available in
stdlib.h header file)
● What is the default storage class in C? (auto is the default storage class where auto
means automatic. All local variables are automatic variables) ● What is a register
storage class?
● What is the default value of a static variable?

🙂🙂🙂🙂🙂🙂🙂🙂

You might also like