×

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 14 Apache Presto Interview Questions for 2024

1) What is Presto? Presto is a distributed SQL query engine. It is an open source software project to develop a database. 2) What are the features of Presto? There are following features...

2 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 30 D Programming Language Interview Questions for 2024

1) What is D programming language? D programming language is an object oriented programming language. It is created by Walter Bright of Digital Mars. It was released in 2001. 2) Who is the...

4 minutes read.

Top 50 ReactJS Interview Questions for 2024

Top 50 Frequently asked ReactJS Interview Questions Q-1. What is React? Ans-1 React is a front-end JavaScript library which is developed by Facebook in 2011. It follows the component-based approach and allows us to...

15 minutes read.

Top 15 Xamarin Interview Questions for 2024

1) What is Xamarin? Xamarin is a .NET framework. It allows to create an application that run on multiple platforms. Xamarin Tutorial uses C# language and .NET framework to deliver native...

2 minutes read.

Top 15 SQL Server Interview Question for 2024

1) Describe SQL Server? SQL server is a DataBase Management System developed by Microsoft. It was first introduced in year 2008 since, then many version has been introduced such as :...

2 minutes read.

Top 15 CherryPy Interview Questions for 2024

1) What is CherryPy? CherryPy is a web framework used for Python. It provides a friendly interface for Http protocol for Python developer. 2) Why we use CherryPy? CherryPy has following strength: Simplicity: It...

3 minutes read.

Top 50 HTML Interview Questions for 2024

1) What is HTML? HTML stands for Hyper Text Markup Language. It is used for creating web pages and web applications. HTML documents are made up of two things: the content and the tags. 2) What are...

10 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 28 Angular 2 Interview Questions for 2024

1) What is Angular 2? It is an open source JavaScript framework which is used to build web applications in JavaScript and HTML. It is also used to overcome obstacles encountered while...

4 minutes read.

Symfony PHP Framework Interview Questions

1) What is Symfony? Symfony is an open source, web application framework. It is written in PHP and used to design PHP applications. It was first released on18 October, 2005. 2) What...

5 minutes read.

Top 30 Perl interview questions for 2024

1) What is Perl? It is a programming language which is used for web development, system administration, GUI development and etc. It is also known as cross-platform programming language. 2) What are the...

4 minutes read.

Top 24 Clojure Interview Questions for 2024

1) What is Clojure? Clojure is a dynamic, general-purpose programming language. It is simple, coherent and powerful tool. It is based on Lisp Programming language. 2) Which platform is used to run...

4 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.

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...

3 minutes read.

Top 30 FuelPHP Framework Interview Questions for 2024

1) What is FuelPHPFramework? FuelPHP Framework is an open source web application and written in PHP scripting language. It is based on the HMVC (Hierarchical Model View Controller) design pattern. It was released...

6 minutes read.

Top 15 PhantomJS Interview Question for 2024

1) What is PhantomJS? PhantomJS is a lightweight headless scripted browser built on WebKit. It is used for automation web page interaction. 2) Why it is called as headless browser? PhantomJS called as...

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 15 KnockoutJS Interview Questions for 2024

1) What is KnockoutJS? It is a JavaScript library which is based on MVVM pattern that helps developers in building rich and responsive websites. 2) Who is the author of KnockoutJS? Steve Sanderson is...

2 minutes read.

Top 14 XSL Interview Questions for 2024

1) What is XSL? XSL stands for Extensible Stylesheet Language. It is used for expressing stylesheets like CSS which describes how to display an XML of given type. 2) What is XSLT? XSLT...

4 minutes read.