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

C Programming Questions Answers

The document contains a series of C programming questions and answers, covering topics such as types of programming languages, features of C, structure of a C program, identifiers and keywords, and different data types in C. It provides examples for each topic to illustrate key concepts. Overall, it serves as a basic guide for understanding C programming.

Uploaded by

Tanvi Jadhav
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)
2 views

C Programming Questions Answers

The document contains a series of C programming questions and answers, covering topics such as types of programming languages, features of C, structure of a C program, identifiers and keywords, and different data types in C. It provides examples for each topic to illustrate key concepts. Overall, it serves as a basic guide for understanding C programming.

Uploaded by

Tanvi Jadhav
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 Questions and Answers

Question 1:

What are the different types of programming languages? Explain with examples.

Answer:

Programming languages are broadly classified into:

1. Machine Language:

- Computers native binary code (0s and 1s).

- Hardware specific and not portable.

Example: 10110000 01100001 (Binary for Intel processor).

2. High-Level Language:

- Human-readable and portable.

- Requires a compiler or interpreter for execution.

Example: C, Java, Python.

Question 2:

What is the C programming language, and what are its key features?

Answer:

C is a general-purpose, structured programming language developed by Dennis Ritchie in the

1970s.

Key Features:

- General-purpose, used for system and application programming.

- Structured language with modular programming.


- Rich library support with built-in functions.

- Efficient memory management and execution speed.

Example:

#include <stdio.h>

void main() { printf("Hello, World!\n"); }

Question 3:

Explain the structure of a C program with an example.

Answer:

A C program consists of:

1. Preprocessor Directives: Include necessary headers.

2. Main Function: Execution starts here.

3. Variable Declarations: Declare variables before use.

4. Statements & Expressions: Define logic and computations.

5. Functions: Modular code sections for reuse.

Example:

#include <stdio.h>

void main() {

int a = 45, b = 17;

int sum = a + b;

printf("Addition: %d\n", sum);

Question 4:
What are identifiers and keywords in C? Explain with examples.

Answer:

Identifiers are names for variables, functions, etc.

- Must start with a letter and can contain digits and underscores.

- Example: int studentAge;

Keywords are reserved words in C.

- Cannot be used as identifiers.

- Example: int, float, return, if, while.

Example:

int main() { int num = 10; return 0; }

Question 5:

What are the different data types in C? Explain with examples.

Answer:

C supports various data types:

1. Basic Data Types:

- int: Stores whole numbers (e.g., 5, 100, -25).

- float: Stores decimal values (e.g., 3.14, -5.6).

- char: Stores single characters (e.g., 'A', 'z').

- double: Stores large floating-point numbers.

2. Derived Data Types:

- Arrays, Pointers, Structures.


Example:

#include <stdio.h>

void main() {

int age = 20;

float height = 5.9;

char grade = 'A';

printf("Age: %d, Height: %.1f, Grade: %c\n", age, height, grade);

You might also like