Assignment 1_ Computer Programming in C-1722507204919
Assignment 1_ Computer Programming in C-1722507204919
Assignment 1
Assignment 1
Note: Attempt any two questions from the following [5 Marks Each]
1. Explain the significance of the C programming language in the history of programming. How did
it influence modern programming languages?
2. Define and explain the following terms in the context of a C program: identifiers, keywords,
constants, strings, and symbols.
3. What are preprocessor directives in C? Discuss their purpose and provide examples of
commonly used preprocessor directives.
Note: Attempt any two questions from the following [10 Marks Each]
1. Explain the concept of variables in C programming. How do you declare a variable and assign a
value to it? Provide examples for different data types such as int, float, and char.
2. Describe the different types of operators available in C (arithmetic, relational, logical, and
bitwise). Provide examples of each type of operator and explain their usage in expressions.
3. What are storage classes in C, and what are their types? Explain the purpose of each
storage class (auto, register, static, extern) and how they affect variable scope and lifetime
with examples.
Note: Attempt any two questions from the following [ 20 Marks Each]
1. Explain the difference between the assignment operator = and the shorthand assignment
operators such as +=, -=, *=, and /= in C. Provide examples demonstrating how these operators
are used in practical programming scenarios.
2. What is the conditional (ternary) operator ?: in C? Write a simple program that uses the ternary
operator to determine the maximum of two numbers and explain how the operator simplifies the
code.
3. Discuss the concepts of type conversion and typecasting in C. Explain the difference between
implicit type conversion and explicit typecasting with examples. How do these practices affect
the behavior and output of expressions?
4. Describe the basic file handling functions in C, including fopen(), fclose(), fread(), and fwrite().
Write a C program to demonstrate how to open a file for writing, write some data to it, and then
read the data back from the file. Explain each step of the process.