JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech I Year PROGRAMMING FOR PROBLEM SOLVING Previous Question Paper (September - 2023 - R22)
Part-A is a compulsory question which consists of ten sub-questions from all units carrying equal marks. Part-B consists of ten questions (numbered from 2 to 11) carrying 10 marks each. From each unit, there are two questions and the student should answer one of them. Hence, the student should answer five questions from Part-B.
Part A
What is compiler?
Answer
A compiler is a special type of program that translates source code written in a high-level programming language (like C, C++, Java) into a lower-level language, typically machine code or bytecode, that a computer's processor can understand and execute. It performs this translation in a single pass or multiple passes, checking for errors in syntax and semantics along the way. If errors are found, the compiler reports them to the programmer. If the code is error-free, it generates an executable file or object code.
Give one example for syntax error.
Answer
A syntax error occurs when the source code violates the grammatical rules of the programming language. For example, forgetting to close a semicolon at the end of a statement in C is a common syntax error. Another example is misspelling a keyword, such as writing 'whlie' instead of 'while'.
Example:
int main() { printf("Hello World") }In this example, the closing curly brace `}` for the `main` function is missing, which is a syntax error.
Define the enumeration data type in C.
Answer
Sign in to view the complete answer paper.
What is a two-dimensional array?
Answer
Sign in to view the complete answer paper.
How do you define a macro using the preprocessor?
Answer
Sign in to view the complete answer paper.
How do you append data to an existing file in C?
Answer
Sign in to view the complete answer paper.
What is recursion?
Answer
Sign in to view the complete answer paper.
What is the signature of a function?
Answer
Sign in to view the complete answer paper.
What is the key difference between linear search and binary search?
Answer
Sign in to view the complete answer paper.
What is the time complexity of selection sort?
Answer
Sign in to view the complete answer paper.
Part B
Differentiate between object code and executable code in the context of compiling a program.
Answer
Sign in to view the complete answer paper.
Discuss the different storage classes in C programming.
Answer
Sign in to view the complete answer paper.
Discuss the different types of loops in C programming.
Answer
Sign in to view the complete answer paper.
How can you pass command line arguments to a C program? Provide a step-by-step explanation.
Answer
Sign in to view the complete answer paper.
Differentiate between a null-terminated string and a fixed-length string.
Answer
Sign in to view the complete answer paper.
Discuss the concept of a union and how it differs from a structure.
Answer
Sign in to view the complete answer paper.
Discuss the significance of pointers in programming and provide examples of their practical usage in manipulating data.
Answer
Sign in to view the complete answer paper.
Compare and contrast text files and binary files in terms of their structure and usage.
Answer
Sign in to view the complete answer paper.
Write a C program to read a text file line by line and display its contents on the console.
Answer
Sign in to view the complete answer paper.
Describe the purpose of conditional compilation directives like #ifdef, #ifndef, and #endif in C.
Answer
Sign in to view the complete answer paper.
Write a C program to read a text file and count the number of lines in it.
Answer
Sign in to view the complete answer paper.
Explain the process of freeing memory in C. What happens if memory is not freed after allocation?
Answer
Sign in to view the complete answer paper.
Discuss the limitations of recursive functions. What factors should be considered before using recursion?
Answer
Sign in to view the complete answer paper.
Describe the concept of passing parameters to functions in C with example programs.
Answer
Sign in to view the complete answer paper.
Write an algorithm for binary search and implement with an example.
Answer
Sign in to view the complete answer paper.
Define Big O notation and explain its significance in analyzing algorithm efficiency.
Answer
Sign in to view the complete answer paper.
Explain the bubble sort algorithm step by step with an example.
Answer
Sign in to view the complete answer paper.