×

Top 15 C Interview Questions for 2024

1) What are different storage class specifiers in C?

Register,auto, static, extern are the storage class specifiers in C.

2) What is scope of a variable? How are variables scoped in C?

Scope of a variable is the part of the program where the variable may directly be accessible. In C, all identifiers are lexically (or statically) scoped.

3) What is memory leak? Why it should be avoided?

"Memory leak" occurs when programmers create memory in heap and forget to delete it.
/*memory leak program */  

#include <stdlib.h>  

   

void f()  

{  

   int *ptr = (int *) malloc(sizeof(int));  

   

   /* Do some work */  

   

   return; /* Return without freeing ptr*/  

}

4) What is NULL pointer?

"Null pointer" is a reserved value of a pointer . A pointer of any type has a reserved value. Each pointer type has its own null value.Conceptually, when a pointer has that null value it is not pointing anywhere.

5) When should we use pointers in a C program?

  1. To get address of a variable.
  2. For achieving pass by reference .
  3. To pass large structures .

6) How will you print "Antarctic Ocean" without semicolon?

int main(void)  

{      if (printf("Antarctic Ocean ")) ;  

           }

7) Can I use "int" data type to store the value of 32769? Why?

No, because "int" data type is capable of storing values from -32768 to32767. To store 32769, you can use "long int" instead.

8) What is debugging?

It is the process of Identifying Errors. The program can't be executed because at compile time errors are found. Debugging ensures the removal of errors.

9) What is wrong in this statement?

scanf("%d",whereareyou);
An ampersand (&) symbol must be placed before the variable name "whereareyou" .

10) What will be the outcome of the following conditional statement if the value of variable A is 10?

A >=10 && A< 25 && A!=12
The outcome will be "TRUE". Since the value of A is 10, A >= 10 evaluates to TRUE because A is not greater than 10 but is still equal to 10. A< 25 is also TRUE since 10 is less then 25. Just the same, A!=12, which means A is not equal to 12, evaluates to TRUE. The && operator is follows the rule that if all individual conditions are TRUE, the entire statement is TRUE.

11) What is wrong with this statement? myName = "Atul";

You cannot use the = sign to assign values to a string variable. Instead, use the strcpy() function. The correct statement would be:
strcpy(myName, "Atul");

12) What is FIFO?

In C programming, there is a data structure known as queue. In this structure, data is stored and accessed using FIFO format, or First-In-First-Out.

13) What is the difference between the = symbol and == symbol?

The = symbol is used in mathematical operations. It is used to assign a value to a given variable. On the other hand, the == symbol, also known as "equal to" is a relational operator that is used to compare two values.

14) Can the curly brackets { } be used to enclose a single line of code?

"Curly Brackets" are mainly used to group many lines of codes, it will still work without error if you used it for a single line.

15) Write a c program to print "Hello World" without using any semicolon?

Three ways to print “Hello World” in c without using semicolon are:
void main(){  

    if(printf("Hello world"))  {  

    }  

}
void main(){  

    while(!printf("Hello world"))  {  

    }  

}
void main(){  

    switch(printf("Hello world"))  {  

    }  

}

Related Topics

Top 30 Joomla Interview Questions for 2024

1) What is Joomla? Joomla is an open source content management system. It is used to build online applications and websites. It uses model-view-controller (MVC) web application framework. It is free and easy to...

4 minutes read.

Top 20 C Programming | Coding Interview Questions for 2024

Most Frequently asked C programming | Coding Interview Questions and answer for Fresher C is a powerful high-level programming language.  It is a fast, portable and available for all platforms. C...

15 minutes read.

Ember.js Interview questions

1) What is Ember.js? Ember.js is a JavaScript front-end Framework. It provides developer both features for managing complexity in modern web-apps as well as integrated development kit. 2) Why choose Ember.js? Logical...

2 minutes read.

Top 15 PouchDB Interview Questions for 2024

1) What is PouchDB? PouchDB is an in-browser database that allows applications to save data. It is an open source database. It runs in Node.js. 2) In which language PouchDB was written? PouchDB was written in JavaScript language. 3)...

2 minutes read.

Top 15 Haskell Interview Questions for 2024

1) What is Haskell? Haskell is a functional programming language. It is based on mathematical functions. This programming language is more intelligent than other popular programming languages. 2) Who is the developer of...

2 minutes read.

Top 27 JavaScript Interview Questions for 2024

1) Define Undeclared and Undefined Variables? Undeclared variable are defined as these variable is neither defined nor exist in the program. If program calls this variable then it causes Runtime error. Undefined variable...

5 minutes read.

Top 30 Cobol Interview Questions for 2024

1) What is COBOL? COBOL is a programming language which is used for finance, business and administrative systems for companies. COBOL is stands for Common Business Oriented Language. 2) What are the features...

4 minutes read.

Top 29 Phalcon Framework Interview Questions for 2024

1) What is Phalcon? Phalcon is an open source framework based on the MVC (Model-View-Controller) pattern. It is the combination of PHP and C language. It is developed by Andres Gutierrez...

6 minutes read.

Top 30 Flex Interview Questions for 2024

1) What is Flex? Flex is an open source framework which is used to build applications for mobile, browser and desktop. It provides FLEX SDK consisting of the Flex class library, Flex...

4 minutes read.

Top 15 JSP Interview Questions for 2024

1) What is JSP? It is a technology which is used to create web application like Servlet technology. It provides more functionality than Servlet. It consists of HTML and JSP tags. 2) What are...

3 minutes read.

Top 26 CouchDB interview questions for 2024

1) What is CouchDB? CouchDB is a document typed database server which can be accessed through RESTful JSON API. It is a schema free and Ad-hoc database with a flat address...

4 minutes read.

PhoneGap Interview Questions 2024

Top 50 Phonegap Interview Questions with their Answers Once you have acquired practical knowledge of the PhoneGap technology, you will now be able to search for a job as a mobile...

9 minutes read.

Top 14 Material Design Lite Interview Questions for 2024

1) What is Material Design Lite? Material Design Lite is UI component Library. It is created with CSS, JavaScript and HTML. It is used for design purpose. It is developed by...

3 minutes read.

Top 15 MATLAB Interview Questions for 2024

1) What is MATLAB? MATLAB (matrix laboratory) is fourth-generation programming language. It allows matrix manipulations, implementations of algorithm and many more. 2) Who developed MATLAB? MATLAB is developed by MathWorks. 3) In which language...

2 minutes read.

Top 22 DOJO Interview Questions for 2024

1) What is DOJO? DOJO is an open source JavaScript framework designed for very fast development of JavaScript/AJAX based application and websites having cross platform interdependencies. 2) Enlist all features of DOJO. ...

4 minutes read.

Top 15 Java JDBC Interview Questions for 2024

1) What are the types of JDBC Drivers in Java? JDBC Drivers are of four types are: JDBC-ODBC bridge driver Native-API driver Network Protocol driver Thin driver 2) What are the five...

4 minutes read.

Top 15 Electron Interview Question for 2024

1) What is Electron? Electron is an open source library developed by Github. It is used to develop cross platform desktop application. 2) Which technology Electron uses? Electron uses Chromium and Node.js with...

3 minutes read.

Top 30 CSS Interview Questions for 2024

1) Define the process where block elements can be centered with css. It can be centered by using margin-left and margin-right properties we can centered the block level elements. 2) Name the...

4 minutes read.

Django Interview Questions for 2024

Django is an open-source python web framework. It is very popular due to the functionalities it offers. It uses the Model-View-Template architecture. Many giant organizations are using Django as their...

10 minutes read.

Top 26 SEO Interview Questions for 2024

Most Frequently asked SEO Interview Questions and Answers for Fresher and Experienced 1) What is SEO? SEO stands for Search Engine Optimization. It is a set of processes followed by website owners...

4 minutes read.