JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA 2017 COMPUTER PROGRAMMING Previous Question Paper (August - 2017 - R13)
This question paper contains two parts A and B. Part A is compulsory. Part B consists of 5 Units. Answer any one full question from each unit.
Part A
Answer all questions in Part A.
Explain the type conversions allowed in ‘C’ Language.
Answer
Type conversion in C converts a value of one data type into another. There are two types:
- Implicit Type Conversion (Type Promotion): Performed automatically by the compiler when different data types are used in an expression. The smaller data type is promoted to the larger type (e.g., char to int, int to float) to prevent data loss.
- Explicit Type Conversion (Type Casting): Performed manually by the programmer using the cast operator (type_name) expression. This forces the conversion of a value to a specific type, which may result in truncation or loss of precision.
What is the use of default alternative in Switch statement? Compare use of switch with nested if-else statement.
Answer
The default case in a switch statement acts as a catch-all block that executes if none of the case constants match the switch expression value. It is optional but recommended for handling unexpected inputs.
Comparison with nested if-else:
- Readability: Switch is cleaner and more readable for multiple discrete integer or character comparisons.
- Flexibility: Nested if-else can handle complex logical conditions and ranges, whereas switch is limited to equality checks against constants.
- Performance: Switch statements are often optimized by compilers into jump tables, making them faster than long chains of if-else conditions.
How to initialize array? Explain with example and write its uses.
Answer
Sign in to view the complete answer paper.
Define structure and union. Explain the way of declaring and accessing them.
Answer
Sign in to view the complete answer paper.
Explain the concept of files, records and fields.
Answer
Sign in to view the complete answer paper.
Part B
What do you understand by operators? Explain the use of the following operators: a) relational b) logical c) arithmetic operators.
Answer
Sign in to view the complete answer paper.
Discuss precedence order and associativity of operators.
Answer
Sign in to view the complete answer paper.
What is typecasting? When should a typecast be used?
Answer
Sign in to view the complete answer paper.
A cashier has currency notes of denominations 10, 50 and 100 each of x, y and z quantities. If the amount to be withdrawn is input through the keyboard, find the total number of currency notes of each denomination the cashier will have to give the withdrawer.
Answer
Sign in to view the complete answer paper.
What are functions? What is the advantage of using function in a program?
Answer
Sign in to view the complete answer paper.
What are macros? Is it better to use a macro or a function?
Answer
Sign in to view the complete answer paper.
Write a C language program to read one matrix and find the sum of its diagonal elements.
Answer
Sign in to view the complete answer paper.
What is dynamic memory allocation? Write and explain the different dynamic memory allocation functions in C.
Answer
Sign in to view the complete answer paper.
What do you understand by strings? How do you declare a string? Write a program to copy one string into another.
Answer
Sign in to view the complete answer paper.
Explain array of structures and structure within a structure with examples.
Answer
Sign in to view the complete answer paper.
Write a program that prints only those lines from a file which are containing more than 50 characters.
Answer
Sign in to view the complete answer paper.
Write a C language program to copy the contents of one file to another file using command line arguments.
Answer
Sign in to view the complete answer paper.