Study resource

Read at your pace, then save it for later.

Year 2025 - SEC 101 - Computer Application

UNIT-I

1. Answer any three from the following questions : [1×3=3 Marks]

(a) Define identifier. [1 Mark]

Answer: An identifier is a user-defined name given to C program elements such as variables, functions, arrays, and structures. It consists of letters, digits, and underscores, beginning with a letter or an underscore.

(b) What do you mean by symbolic constant? [1 Mark]

Answer: A symbolic constant is a name given to a constant value that does not change throughout the execution of a program, usually defined using the #define preprocessor directive (e.g., #define PI 3.14159).

(c) Write down the syntax of conditional operator. [1 Mark]

Answer: The syntax of the ternary/conditional operator is: expression1 ? expression2 : expression3;

(d) What is the use of 'goto' statement? [1 Mark]

Answer: The goto statement is an unconditional jump statement used to transfer program execution control directly to a specified labeled statement within the same function.

2. Answer any one from the following questions: [2 Marks]

(a) Differentiate between 'while' and 'do-while'. [2 Marks]

Answer:

Featurewhile loopdo-while loop
TypeEntry-controlled loopExit-controlled loop
ExecutionCondition is checked before executing the loop body. Executed 0 times if condition is initially false.Loop body executes at least once before checking the condition.

(b) Write a short note on derived data types used in C. [2 Marks]

Answer: Derived data types in C are built using primary/primitive data types (like int, char, float). They allow grouping multiple data items or accessing memory locations efficiently. Key examples include arrays (homogeneous collections), pointers (variables storing memory addresses), and functions.

3. Answer any one from the following questions: [5 Marks]

(a) Discuss the different types of operators used in C. [5 Marks]

Answer:

Introduction

An operator is a symbol that instructs the C compiler to perform specific mathematical, logical, or relational manipulations on operands.

Major Types of Operators in C

  • Arithmetic Operators: Used to perform mathematical calculations. Include + (addition), - (subtraction), * (multiplication), / (division), and % (modulus).
  • Relational Operators: Used to compare two values. Include == (equal to), != (not equal to), >, <, >=, and <=. Returns true (1) or false (0).
  • Logical Operators: Used to combine multiple conditions. Include && (Logical AND), || (Logical OR), and ! (Logical NOT).
  • Assignment Operators: Used to assign values to variables. Include simple assignment = and compound assignments like +=, -=, *=, /=, and %=.
  • Increment and Decrement Operators: Unary operators used to increase or decrease a variable's value by 1, represented as ++ and -- (prefix and postfix forms).
  • Bitwise Operators: Perform operations at the bit level. Include & (AND), | (OR), ^ (XOR), ~ (NOT), << (Left shift), and >> (Right shift).
  • Conditional (Ternary) Operator: Evaluates a condition using condition ? val_if_true : val_if_false.
  • Special Operators: Includes sizeof (returns size of data type/variable), address-of &, pointer dereference *, and comma operator ,.

Conclusion

Operators form the fundamental building blocks for constructing dynamic logic and computational expressions in C language.

(b) Write a C program to perform four basic arithmetic operations using switch statement. [5 Marks]

Answer:

Program Logic

The program prompts the user to select an operation (addition, subtraction, multiplication, division) and input two numbers. The switch statement executes the corresponding block depending on the selected choice.

C Program Code

#include <stdio.h>

int main() {
    char op;
    double num1, num2, result;
    printf(


xxx

Did this help you understand better?

Your feedback improves the quality of this resource for everyone.