0% found this document useful (0 votes)
21 views3 pages

C Programming Important Questions Guide

The document outlines important questions from the first six chapters of a C programming course, categorized by marks allocation. It covers topics such as the history of C, program structure, data types, input/output functions, operators, and control statements. Each section includes questions of varying difficulty, aimed at assessing understanding of fundamental C programming concepts.
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)
21 views3 pages

C Programming Important Questions Guide

The document outlines important questions from the first six chapters of a C programming course, categorized by marks allocation. It covers topics such as the history of C, program structure, data types, input/output functions, operators, and control statements. Each section includes questions of varying difficulty, aimed at assessing understanding of fundamental C programming concepts.
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

CE MST Important Questions (First Six Chapters)

1. Introduction

10 Marks Questions:
- Explain the history and features of C language.
- Differentiate between Compiler and Interpreter with examples.

15 Marks Questions:
- Discuss the structure of a C program with an example.
- Explain the different stages of program development in C.

2.5 Marks Questions:


- Who developed C language?
- Write full form of ANSI.

2. Preparing and Running a C Program

10 Marks Questions:
- Explain the steps involved in preparing and running a C program.
- Differentiate between Source code, Object code, and Executable code.

15 Marks Questions:
- Draw and explain the flow of program execution in C from writing to running.
- Explain the role of Compiler, Linker, and Loader in C programming.

2.5 Marks Questions:


- What is the extension of a C source file?
- Write the command to compile a C program in Turbo C.

3. C Fundamentals

10 Marks Questions:
- Explain keywords, identifiers, constants, and variables with examples.
- Differentiate between local and global variables.

15 Marks Questions:
- Explain data types in C with memory size and range.
- Discuss symbolic constants and type casting in C with examples.
2.5 Marks Questions:
- Give example of a valid identifier in C.
- Write the range of int data type in C.

4. Data Input and Output

10 Marks Questions:
- Explain scanf() and printf() functions with suitable examples.
- Differentiate between getchar(), putchar() and gets(), puts().

15 Marks Questions:
- Discuss formatted and unformatted input-output functions in C.
- Explain the role of escape sequences with examples.

2.5 Marks Questions:


- Write the format specifier for float and character data type.
- Which header file is required for printf()?

5. Operators

10 Marks Questions:
- Differentiate between unary, binary, and ternary operators.
- Explain the difference between logical AND, OR, and NOT operators.

15 Marks Questions:
- Explain operator precedence and associativity in C with examples.
- Discuss the difference between increment (++), decrement (--) and assignment operators with
examples.

2.5 Marks Questions:


- Write the symbol of conditional operator in C.
- Give an example of modulus operator.

6. Control Statements

10 Marks Questions:
- Explain the difference between entry-controlled and exit-controlled loops.
- Differentiate between if, if-else, and switch statements with examples.

15 Marks Questions:
- Discuss different looping constructs in C with syntax and examples.
- Explain nested if and switch statements with examples.

2.5 Marks Questions:


- Write the syntax of while loop.
- Which statement is used to terminate a loop immediately?

Common questions

Powered by AI

Escape sequences in C are used to represent special characters within string literals and character constants. They start with a backslash (\). For instance, \n represents a newline, \t a tab space, and \\ a literal backslash. These sequences allow the insertion of invisible characters into output easily .

A C program typically consists of several structural components: preprocessor directives, main function, variable declarations, statement blocks, and function definitions. Preprocessor directives include libraries like #include <stdio.h>. The main function, int main(), serves as the entry point for execution. Within the main, we declare variables that store data used in computations. Statements perform actions, and functions can be defined to encapsulate reusable logic. For example, a simple C program may start with #include <stdio.h> followed by int main() { int a = 10; printf("Value of a is %d", a); return 0; } .

Operator precedence determines the order in which operators are evaluated in expressions. Associativity defines the order of evaluation when operators have the same precedence. For instance, in C, multiplication (*) and division (/) have higher precedence over addition (+) and subtraction (-). Associativity for these is left-to-right, so in 5 + 3 * 2, multiplication happens first. Similarly, the assignment operator (=) has right-to-left associativity .

The compiler translates the source code written in C into object code, checking for errors during the translation. The linker takes this object code and links it with other object files and libraries to create an executable file. The loader then loads this executable into memory, setting the program up for execution by the CPU .

Nested loops involve placing one loop inside another, useful for multidimensional data. Nested `if` allows a conditional to trigger another check: `if (a > b) { if (a > c) { ... } }`. In switch, one statement can appear in a case block of another: `switch(x) { case 1: switch(y) { case 2: ...; } }`. These structures allow complex decision-making and iteration .

The development stages involve writing, compiling, linking, and running the program. Initially, source code is written in a text editor and saved with a .c extension. This source code is compiled, converting into an object code by the compiler, which checks for syntax errors. The linker then combines this object code with libraries to produce an executable code. The loader places the program into memory, and the CPU executes it .

Local variables are defined within a function or block and can only be accessed in that scope. Global variables are defined outside functions and are accessible from any function within the file. For example, in C: int g; void f1() { int l; } Here, 'g' is global, accessible everywhere, whereas 'l' is local, only accessible within f1().

`if-else` is used for conditional branching based on boolean expressions, allowing for complex logical conditions. `switch` is generally simpler, suitable for selection among fixed values. For example, `if-else` can handle ranges, while `switch` works with constant integer cases: `if(a > b) { ... } else { ... }` vs `switch(a) { case 1: ...; break; case 2: ...; break; }` .

Source code is the human-readable instructions written in C, saved as a '.c' file. Object code is the machine-readable code outputted by the compiler, often saved as '.o' files, and is not yet complete for execution since it lacks linked resources. Executable code is the fully compiled and linked machine code that can be run by an operating system, typically in '.exe' format .

Formatted I/O functions, such as printf() and scanf(), allow structured data interaction. printf() outputs formatted text: `printf("%d", integer);`, while scanf() reads formatted input: `scanf("%d", &variable);`. They enable precise data handling, ensuring correct types and formats in operations .

You might also like