Skip to main content

C Interview Questions

If you’re preparing for C programming interview questions, then you are at the right site. Here are the best common interview questions on c to help you get going for that job interview.


Who Invented C Language?

 C was originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973 to construct utilities running on Unix.

What is the objective of the main () function in C?

main() function is starting point of program execution. When program execution start the control of the program is directed towards the main() function. It is mandatory that every C language program has a main () function.

What is difference between variables and constant?

The value assigned to variable can be changed in-between execution but value assigned to constant remains changed during entire program.


Can a C program compile without the main() function ?

Yes, a C program can be compiled even without adding the main() function in a program but, it will not execute without the main() function.

What are the basic datatypes in c?

1.Integer, 2.Float, 3.Double, 4.Void, 5.Character

What are the various Keywords used in C?

Keywords in c

What is Memory Leak in C?

When programmers create a memory in the heap and forget to delete it. It decreases the efficiency of the performance of the system is called a memory leak.

Why we include header files? What it contains?

The header file contains a declaration of in-built functions. A function declaration is added to the program during compilation.

What Library files contains?

Library files contains definition of in-built functions. Linker add library files during linking.

What is Structure?

Structure is a user defined datatype. It is defined as below,

struct structure_name{ structure body };

What is Union?

Union is a user defined datatype. It is defined as below,

union union_name{ body };

What is a pointer?

Pointer is a variable which store the address of another variable.

What is double pointer?

Double pointer stores the address of another pointer.

What is void pointer?

Pointer which doesn’t points to any memory location is called void pointer. It contains Null.

What is dangling pointer?

The pointer which points to a deleted memory location is called the dangling pointer. To avoid dangling the pointer, after deleting the memory location, we must add Null value to the pointer.

What is wild pointer?

Uninitialized pointer in the C code is called Wild Pointer. They point to some arbitrary memory location and can cause bad program behavior or program crash.

What malloc() and calloc() do?

These are used to allocating memory at runtime. malloc() allocate a single large block of memory with the specified size. calloc() allocate the specified number of blocks of memory of the specified size.

What is call by value and call by reference?

Call by value- Values are passed from function call i.e actual parameter to formal parameter. Any changes in formal parameters do not reflect back to the actual parameter.


Call by reference- Address is passed from function call i.e actual parameter to formal parameter. Any changes in formal parameters reflect back to the actual parameter.


Data structure interview questions


Interview Questions On Object oriented programming


SQL Interview questions


TCS NQT-2021 coding questions


Snake game using python

Comments

Favourite post

Part 2 : TCS DCA python coding questions

TCS wings1 DCA python coding TCS elevate wings1 coding questions This post contains only coding questions asked in TCS digital wings1 or tcs elevate wings1 exam. If anyone want coding answer of these questions please comment me or reach me through email provided. Given a string str which consists of only 3 letters representing the color,(H) Hue, (S) Saturation, (L) Lightness, called HSL colors. The task is to count the occurrence of ordered triplet “H, S, L” in a given string and give this count as the output. This question was asked in April 21 Digital Capababilty Assessment Examples: A) Input HHSL Output 2 Explanation : There are two triplets of RGB in the given string: H at index O, S at index 2 and Lat index 3 forms one triplet of HSL. H at index 1, S at index 2 and Lat index 3 forms the second triplet of HSL. B) Input:   SHL Output: 0 Explanation : No triplets exists. In this 3 Palindrome, Given an input string word, split the string into exactly 3 palindromic substrings. Work...

Part 1 : TCS DCA python coding questions

TCS wings1 DCA python coding TCS elevate wings1 coding questions This post contains only coding questions asked in TCS digital wings1 or tcs elevate wings1 exam. If anyone want coding answer of these questions please comment me or reach me through email provided. Find how many Sexy Prime Numbers in a given range k and p.  Sexy prime means the prime numbers that differ from each other by 6. Where difference between two sexy prime numbers is 6. Constraint: 2 <=p<k<= 1000,000,000. Sample Input: 4  40 Output: 7 Explanation: [5,11] [7,13] [11,17] [13,19] [17,23]  [23,29] [31,37] Problem Description -: Given two non-negative integers n1 and n2, where n1 For example: Suppose n1=11 and n2=15. There is the number 11, which has repeated digits, but 12, 13, 14 and 15 have no repeated digits. So, the output is 4. Example1: Input: 11 — Vlaue of n1 15 — value of n2 Output: 4 Example 2: Input: 101 — value of n1 200 — value of n2 Output: 72 Consider the string S1 = 321 All char...

Calculator program using python tkinter

Project Name:- Simple Calculator Software using Python Tkinter. Dependencies:-                           1)Install  Tkinter- https://www.techinfected.net/2015/09/how-to-install-and-use-tkinter-in-ubuntu-debian-linux-mint.html                                 2)Install Math Library- for python3- pip3 install math  for python2- pip install math  ******************************************//************************************************************************ from tkinter import * from math import * class cal: def press( self ,n): self .text.insert(INSERT,n) def dl( self ): self .text.delete( 1.0 , 2.0 ) def equal( self ): self .exp= self .text.get( 1.0 ,END) try : self .result= eval ( self .exp) self .text.delete( 1.0 , 2.0 ) ...