Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions Network Architect Interview Questions

Top 15 C Interview Questions for 2022

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"))  {  

    }  

}