JNTU
JNTU B.Tech I Year COMPUTER PROGRAMMING Previous Question Paper (September - 2023 - R15)
Part A is compulsory. In Part B, Answer any one question from each unit.
Part A
Consider the following code:
int main() { int a = 5,b=6,c; c = (++a) + (b<<2); printf(“a = %d , b= %d , c= %d \n”, a, b, c); }What is the output of above code? Justify your answer with two to three lines of explanation.
Answer
The output of the code is: a = 6 , b = 6 , c = 30
Explanation: The pre-increment operator ++a increases the value of a from 5 to 6 before the addition. The left-shift operator b<<2 shifts the binary representation of 6 (0110) two positions to the left, resulting in 24 (11000). Finally, c is calculated as 6 + 24 = 30.
Differentiate while loop and do-while loop.
Answer
The primary differences between a while loop and a do-while loop are as follows:
- Entry vs. Exit Controlled: A while loop is an entry-controlled loop, meaning the condition is evaluated before the loop body executes. A do-while loop is an exit-controlled loop, where the body executes at least once before the condition is checked.
- Execution Guarantee: In a while loop, if the condition is false initially, the loop body never executes. In a do-while loop, the body is guaranteed to execute at least once regardless of the condition.
- Syntax Structure: The while loop uses the structure
while(condition) { ... }, whereas the do-while loop usesdo { ... } while(condition);, which requires a semicolon after the condition.
Develop a recursive function to find factorial of a given number.
Answer
Sign in to view the complete answer paper.
List different ways of initializing one dimensional array.
Answer
Sign in to view the complete answer paper.
How you define a pointer to an array. Give an example for it.
Answer
Sign in to view the complete answer paper.
How you declare a pointer to a function and how you call the function with the help that pointer variable? Give an example.
Answer
Sign in to view the complete answer paper.
Differentiate binary files with text files.
Answer
Sign in to view the complete answer paper.
Give an example of nested structure.
Answer
Sign in to view the complete answer paper.
Discuss the push operation of stack.
Answer
Sign in to view the complete answer paper.
List the applications of Queue data structure.
Answer
Sign in to view the complete answer paper.
Part B
Discuss about bitwise operators in C Language. Consider the expression X = 5+4*5 + a << 3, where a=4. Find the value of the variable X and also discuss about operator precedence and associativity in this context.
Answer
Sign in to view the complete answer paper.
Malathi has 3 bags with weights A, B, and C. She wants to check-in exactly two and carry one. Check-in sum cannot exceed D and carried bag cannot exceed E. Find if Malathi can take all the three bags.
Answer
Sign in to view the complete answer paper.
Discuss about different data types in C Language.
Answer
Sign in to view the complete answer paper.
Develop C code to find whether Kattappa is ready for battle based on the count of lucky soldiers (even number of weapons) being strictly more than unlucky soldiers.
Answer
Sign in to view the complete answer paper.
Write a C program to read n values into an array and arrange them in increasing order.
Answer
Sign in to view the complete answer paper.
Explain the types of arrays in C.
Answer
Sign in to view the complete answer paper.
List the limitations of recursive functions.
Answer
Sign in to view the complete answer paper.
Explain different parameter passing mechanisms in C language.
Answer
Sign in to view the complete answer paper.
Explain the concept of passing array to function with an example.
Answer
Sign in to view the complete answer paper.
Write a C program to verify a substring str1 is present in another string str2 or not?
Answer
Sign in to view the complete answer paper.
Write a C program to check a given string is palindrome or not.
Answer
Sign in to view the complete answer paper.
Discuss about different dynamic memory allocation functions.
Answer
Sign in to view the complete answer paper.
Write a C program to define a structure called employee. Read n employees information (empid, empname, salary) and print it and find average salary.
Answer
Sign in to view the complete answer paper.
Discuss about modes of opening a file.
Answer
Sign in to view the complete answer paper.
Write a C code which reads two integers a, b (a
Answer
Sign in to view the complete answer paper.
Write about self-referential structures.
Answer
Sign in to view the complete answer paper.
Apply bubble sort on the following list: 4, 1, 7, 9, 11, 34, 21, 45, 22.
Answer
Sign in to view the complete answer paper.
Write a C program to implement linear search.
Answer
Sign in to view the complete answer paper.
Give the concept of binary search with a suitable example.
Answer
Sign in to view the complete answer paper.
Explain insert and delete operation in single linked list.
Answer
Sign in to view the complete answer paper.