0% found this document useful (0 votes)
16 views

C_Programming_Interview_QA

The document provides an overview of C programming language, its features, and fundamental concepts such as data types, control structures, and memory management. It includes comparisons between compilers and interpreters, as well as explanations of functions, arrays, and pointers. Additionally, it covers important distinctions like '=' vs '==' and static vs extern.

Uploaded by

nisitha121004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

C_Programming_Interview_QA

The document provides an overview of C programming language, its features, and fundamental concepts such as data types, control structures, and memory management. It includes comparisons between compilers and interpreters, as well as explanations of functions, arrays, and pointers. Additionally, it covers important distinctions like '=' vs '==' and static vs extern.

Uploaded by

nisitha121004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

C Programming Interview Questions and Answers

1. What is C language?

C is a procedural programming language developed in the 1970s by Dennis Ritchie. It is known for

system-level programming, speed, and portability.

2. Features of C:

- Fast and efficient

- Rich library of built-in functions

- Low-level and high-level features

- Structured and modular

- Portable

3. Compiler vs Interpreter:

Compiler: Translates whole code; faster execution; used in C, C++.

Interpreter: Line-by-line translation; slower; used in Python, JavaScript.

4. Structure of a C program:

#include <stdio.h>

int main() {

printf("Hello!");

return 0;

5. Keywords in C:

Reserved words like int, float, if, else, for, return.


6. Variables in C:

Named memory locations. Example: int age = 25;

7. Data Types:

- int: 2 or 4 bytes

- float: 4 bytes

- double: 8 bytes

- char: 1 byte

8. Operators:

Arithmetic, Relational, Logical, Bitwise, Assignment, Increment/Decrement

9. '=' vs '==':

= assigns value; == compares two values.

10. sizeof:

Returns size of a variable/data type.

11. Control Structures:

- if, else if, switch for condition checking

- for, while, do-while for loops

- break exits loop; continue skips iteration

12. Functions:

Reusable code blocks. Example:

int add(int a, int b) { return a + b; }


13. Call by value/reference:

Value: Original not affected. Reference: Original can change.

14. Recursion:

Function calling itself. Example: factorial.

15. Arrays:

Collection of same data type. Example: int arr[5];

16. Strings:

Char arrays ending with '\0'. Example: char name[] = "John";

17. scanf vs gets:

scanf stops at space; gets reads full line.

18. Pointers:

Stores address. Example: int *ptr = &a;

19. Structure vs Union:

Structure: Different types, individual memory. Union: Shared memory.

20. Dynamic Memory:

malloc, calloc, realloc allocate memory; free deallocates.

21. File Handling:

fopen("file.txt", "r"); Modes: "r", "w", "a", etc.


22. Typedef vs #define:

typedef creates alias; #define creates macros.

23. static vs extern:

static: Limited scope. extern: Global linkage.

24. Compile Time vs Run Time:

Compile time: Syntax check. Run time: Logic errors.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy