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

C Programming Questions Answers

C program

Uploaded by

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

C Programming Questions Answers

C program

Uploaded by

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

Important C Programming Questions with Answers

1. Define C programming and list its primary uses.


C is a general-purpose, high-level, procedural programming language. It is used for system
programming, developing operating systems, games, and software applications.

2. What are the advantages and disadvantages of C programming?


Advantages: - Efficiency - Portability - Low-level access - Large user community Disadvantages: -
Steep learning curve - Lack of memory management - No built-in support for object-oriented
programming

3. Explain the key features of the C language with examples.


Key features include simplicity, fast speed, portability, memory management, and support for pointers.
Example: #include <stdio.h> int main() { printf("Hello, World!"); return 0; }

4. What are the types of comments in C? Provide examples.


Single-line comment: // This is a comment Multi-line comment: /* This is a multi-line comment */

5. Define tokens in C. Name and explain the types of tokens.


A token is the smallest unit in a C program. Types include: - Keywords (e.g., int, return) - Identifiers
(e.g., main, sum) - Constants (123, 'A') - Strings ("Hello") - Special symbols ({, }) - Operators (+, -)

6. Differentiate between constants and variables in C with examples.


Constants have fixed values, whereas variables store data that can change. Example: const float PI =
3.14; // Constant int age = 25; // Variable

7. What are the rules for naming identifiers and variables?


- Must begin with a letter or underscore. - Can include letters, digits, and underscores. - Cannot use
keywords or whitespace.

8. List the primary data types in C with their sizes and ranges.
- int (2 bytes, -32,768 to 32,767) - char (1 byte, -128 to 127) - float (4 bytes, up to 6 decimal places) -
double (8 bytes, up to 15 decimal places)

You might also like