C - Tutorial
     

C - Interview Qestion and Answers

Interview Q&A

Q1: Tell me about yourself? (Common question for all interviews)

Answer: “I graduated with a Computer degree in 2020, and was offered a softwre engineer position from a leading software company I had interned with. I loved working with coding and development and growing my personlity, but the industry we were in just wasn’t very appealing to me. After that, I stayed a full year and learned a ton about how to build and manage successfully and I ended up becoming a top performer in my group before leaving. I left at the 1-year-mark to pursue a very similar position within an industry I’m much more excited about- Data related developments. I’ve been at this Bigdata startup space for 2 years with this company and I feel ready to take my career to the next level so that’s why I’m currently looking for a new opportunity.”


Q2: What are the main features in the C programming?
Answer:

Portability: It is a platform-independent language.
Modularity: Possibility to break down large programs into small modules.
Flexibility: The possibility of a programmer to control the language.
Speed: C comes with support for system programming and hence it compiles and executes with high speed when compared with other high-level languages.
Extensibility: Possibility to add new features by the programmer.


Q3: What are the basic data types in C?
Answer:

Int – Represent the number (integer)
Float – Number with a fraction part
Double – Double-precision floating-point value
Char – Single character
Void – Special purpose type without any value.


Q4: What are reserved words in C programming language?
Answer:

The words that are a part of the standard C language library are called reserved words. Those reserved words have special meaning and it is not possible to use them for any activity other than its intended functionality.

Examples:    main, void, return, int.


Q5: What is the description for syntax errors?
Answer:

The mistakes/errors that occur while creating a program are called syntax errors. Misspelled commands or incorrect case commands, an incorrect number of parameters in calling method /function, data type mismatches can be identified as common examples for syntax errors.


Q6: Describe static function with its usage?
Answer:

A function, which has a function definition prefixed with a static keyword is defined as a static function. The static function should be called within the same source code.


Q7: What is the difference between ++a and a++?
Answer:

‘++a” is called prefixed increment and the increment will happen first on a variable. ‘a++’ is called postfix increment and the increment happens after the value of a variable used for the operations.


Q8: Describe the difference between = and == symbols in C programming?
Answer:

‘==’ is the comparison operator which is used to compare the value or expression on the left-hand side with the value or expression on the right-hand side.

‘=’ is the assignment operator which is used to assign the value of the right-hand side to the variable on the left-hand side.


Q9: What is the explanation for prototype function in C?
Answer:

Prototype function is a declaration of a function with the following information to the compiler.

  • Name of the function.
  • The return type of the function.
  • Parameters list of the function.
Ex:   int sum(int, int);

In this example Name of the function is Sum, the return type is the integer data type and it accepts two integer parameters.


Q10: Describe the header file and its usage in C programming?
Answer:

The file containing the definitions and prototypes of the functions being used in the program are called a header file.
It is also known as a library file.

Ex:The header file contains commands like printf and scanf is from the stdio.h library file.


Q11: What are the for loop statements available in C?
Answer:
There are 4 types of loop statements in C.
  • While loop
  • For Loop
  • Do…While Loop
  • Nested Loop

Q12: What is a nested loop?
Answer:

A loop that runs within another loop is referred to as a nested loop. The first loop is called the Outer Loop and the inside loop is called the Inner Loop. The inner loop executes the number of times defined in an outer loop.


Q13: What is a pointer on a pointer in C programming language?
Answer:

A pointer variable that contains the address of another pointer variable is called pointer on a pointer. This concept de-refers twice to point to the data held by a pointer variable.

Ex:  int a=5, *x=&a, **y=&x;

In this example **y returns the value of the variable a.

Q14: What are the valid places to have keyword “Break”?
Answer:

The purpose of the Break keyword is to bring the control out of the code block which is executing. It can appear only in looping or switch statements.


Q15: What is the behavioral difference when the header file is included in double-quotes (“”) and angular braces (<>)?
Answer:

Header file is included within double quotes (“ ”), compiler search first in the working directory for the particular header file. If not found, then it searches the file in the include path. But when the Header file is included within angular braces (<>), the compiler only searches in the working directory for the particular header file.


Q16: What is the significance of C program algorithms?
Answer:

The algorithm is created first and it contains step by step guidelines on how the solution should be. Also, it contains the steps to consider and the required calculations/operations within the program.


Q17: Is there any possibility to create a customized header file with C programming language?
Answer:

Yes, it is possible and easy to create a new header file. Create a file with function prototypes that are used inside the program. Include the file in the ‘#include’ section from its name.


Q18: What are different storage class specifiers in C?
Answer:

Ex:   auto, register, static, extern


Q19: What is a sequential access file?
Answer:

General programs store data into files and retrieve existing data from files. With the sequential access file, such data are saved in a sequential pattern. When retrieving data from such files each data is read one by one until the required information is found.


Q20: What is the difference between Call by Value and Call by Reference?
Answer:

When using Call by Value, you are sending the value of a variable as parameter to a function, whereas Call by Reference sends the address of the variable. Also, under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the function.

www.reshman.online