JNTU
JNTU B.Tech I PROGRAMMING FOR PROBLEM SOLVING Previous Question Paper (September/October - 2021 - R18)
Answer any five questions
All questions carry equal marks
Main
What is flow chart? Draw a flowchart to generate Fibonacci sequence up to ‘n’ numbers.
Answer
A flowchart is a graphical representation of an algorithm or a step-by-step process used to solve a problem. It uses standardized symbols such as ovals for start/end, parallelograms for input/output, rectangles for processing, and diamonds for decision-making, connected by flow lines to indicate the sequence of operations.
To generate the Fibonacci sequence up to n numbers:
- Start.
- Read the value of n.
- Initialize variables: a = 0, b = 1, count = 0.
- If count is less than n, print a.
- Calculate next term: next = a + b.
- Update variables: a = b, b = next, count = count + 1.
- Repeat from step 4 until count equals n.
- Stop.
In C if any variable is auto storage class by default, then why auto keyword introduced in C? Explain.
Answer
In C, the auto storage class is the default for all local variables defined within a function or block. The auto keyword was introduced primarily for historical reasons and to maintain compatibility with the B programming language, from which C evolved.
While it is redundant in modern C programming, the keyword serves specific purposes:
- Explicit Documentation: It allows a programmer to explicitly declare the storage class of a variable, making the code's intent clear to others reading it, even if the compiler would have assumed it by default.
- Consistency: It provides symmetry with other storage class specifiers like static, extern, and register. By using auto, the programmer can explicitly specify the storage class for every variable, ensuring a uniform coding style.
- Future-proofing: In the C++ language, the meaning of auto was repurposed for type inference. Keeping the keyword in the C standard helps maintain a level of syntactical similarity between C and C++.
What is an array? Write a ‘C’ program for Matrix Multiplication.
Answer
Sign in to view the complete answer paper.
Write the use of Pointers in self-referential structures.
Answer
Sign in to view the complete answer paper.
Explain the basic operations performed on file.
Answer
Sign in to view the complete answer paper.
What is the use of the preprocessor directives? Explain.
Answer
Sign in to view the complete answer paper.
Write a program to differentiate the structure and union memory allocations using size of function.
Answer
Sign in to view the complete answer paper.
Explain the use of array of structures with an example program.
Answer
Sign in to view the complete answer paper.
Explain bubble sort with an example.
Answer
Sign in to view the complete answer paper.
Give a brief note on insertion sort.
Answer
Sign in to view the complete answer paper.
Define Data type. Briefly discuss the fundamental data types supported in C.
Answer
Sign in to view the complete answer paper.
How entry controlled loop is different from exit controlled loop? Explain.
Answer
Sign in to view the complete answer paper.
List the advantages of Pointers. Explain about pointers to structures.
Answer
Sign in to view the complete answer paper.
Describe String library functions with syntax as well as example program.
Answer
Sign in to view the complete answer paper.
Explain recursion with an example program.
Answer
Sign in to view the complete answer paper.
Write a note on dynamics memory allocation.
Answer
Sign in to view the complete answer paper.