JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA 1 C AND DATA STRUCTURES Previous Question Paper (July/August - 2021 - R20)
Answer any five questions. All questions carry equal marks.
Main
Write about different operators supported in C language with example.
Answer
C language provides a rich set of operators to perform various operations on data. They are categorized as follows:
- Arithmetic Operators: Used for mathematical calculations (+, -, *, /, %). Example: a + b.
- Relational Operators: Used to compare two values (==, !=, >, <, >=, <=). Example: a > b returns 1 if true.
- Logical Operators: Used to combine conditions (&&, ||, !). Example: (a > 5 && b < 10).
- Assignment Operators: Used to assign values to variables (=, +=, -=, *=, /=). Example: a += 5 is equivalent to a = a + 5.
- Bitwise Operators: Perform operations at the bit level (&, |, ^, ~, <<, >>). Example: a & b.
- Increment/Decrement Operators: Used to change the value of a variable by 1 (++a, a++, --a, a--).
- Conditional (Ternary) Operator: A shorthand for if-else (? :). Example: (a > b) ? a : b;
- Special Operators: Includes comma operator (,), sizeof operator, and pointer operators (&, *).
What is Type casting? Explain about various type conversions allowed in C language.
Answer
Type casting is the process of converting a variable from one data type to another. C supports two types of conversions:
- Implicit Type Conversion (Automatic): Performed automatically by the compiler when different data types are used in an expression. The compiler promotes the smaller type to the larger type to prevent data loss (e.g., char/short to int, int to float). int a = 10; float b = 5.5; float res = a + b; // a is promoted to float
- Explicit Type Conversion (Type Casting): Performed manually by the programmer using the cast operator (type_name). This is necessary when converting a larger type to a smaller type, which may result in data truncation. (type_name) expression;Example:float x = 10.5; int y = (int)x; // x is explicitly cast to int, resulting in 10
Explain the significance of ‘break’ and ‘continue’ statement with suitable program.
Answer
Sign in to view the complete answer paper.
Write ‘C’ program to print the Fibonacci sequence upto given number using while loop.
Answer
Sign in to view the complete answer paper.
Define two-dimensional array. Write a C program for addition of two matrices.
Answer
Sign in to view the complete answer paper.
Discuss about pointers to pointers with suitable C program.
Answer
Sign in to view the complete answer paper.
How to pass a structure to a function? Explain with a C program.
Answer
Sign in to view the complete answer paper.
Write a C program to copy the contents of one file to another.
Answer
Sign in to view the complete answer paper.
Write a C program to sort given elements using insertion sort: 20, 5, 39, 16, 65, 40.
Answer
Sign in to view the complete answer paper.
Write about the procedure for insert and delete operations using Queue.
Answer
Sign in to view the complete answer paper.
What are the benefits of flowchart? Draw a flow chart to find given number is even or odd number.
Answer
Sign in to view the complete answer paper.
Discuss about different types of computer languages in detail.
Answer
Sign in to view the complete answer paper.
Write about storage classes in ‘C’ with examples.
Answer
Sign in to view the complete answer paper.
What is user-defined function? Explain about actual and formal parameters.
Answer
Sign in to view the complete answer paper.
Differentiate between Structures and Unions with examples.
Answer
Sign in to view the complete answer paper.
Explain various string handling functions with syntax and examples.
Answer
Sign in to view the complete answer paper.