JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech I Year COMPUTER PROGRAMMING Previous Question Paper (July - 2021 - R13)
Answer any five questions. All questions carry equal marks.
Main
Write a program to find whether the given number is palindrom or not.
Answer
A palindrome number is a number that remains the same when its digits are reversed. The logic involves extracting each digit using the modulo operator and building the reversed number.
#include <stdio.h>
int main() {
int n, reversed = 0, remainder, original;
printf("Enter an integer: ");
scanf("%d", &n);
original = n;
while (n != 0) {
remainder = n % 10;
reversed = reversed * 10 + remainder;
n /= 10;
}
if (original == reversed)
printf("%d is a palindrome.", original);
else
printf("%d is not a palindrome.", original);
return 0;
}Explain the usage of break, continue and goto statements with a sample C program.
Answer
These control flow statements alter the normal execution sequence of a program:
- break: Terminates the nearest enclosing loop or switch statement immediately.
- continue: Skips the remaining statements in the current iteration of a loop and jumps to the next iteration.
- goto: Performs an unconditional jump to a labeled statement within the same function.
#include <stdio.h>
int main() {
for (int i = 1; i <= 5; i++) {
if (i == 2) continue; // Skips 2
if (i == 4) break; // Exits loop at 4
printf("%d ", i);
}
goto label;
printf("This will be skipped");
label: printf("\nJumped to label.");
return 0;
}Discuss about recursive functions. Write a C program to find factorial of a given number N by using recursive function.
Answer
Sign in to view the complete answer paper.
What is an array? Explain how to declare an array.
Answer
Sign in to view the complete answer paper.
What is meant by array of pointers? Explain its usage with a sample C program.
Answer
Sign in to view the complete answer paper.
Write a program to concatenate two strings.
Answer
Sign in to view the complete answer paper.
Explain about passing structures through pointers with a sample C-program.
Answer
Sign in to view the complete answer paper.
Explain about command line argument with an example.
Answer
Sign in to view the complete answer paper.
Distinguish between selection sort and bubble sort.
Answer
Sign in to view the complete answer paper.
Write a program to implement the operations of stack.
Answer
Sign in to view the complete answer paper.
Explain about different types of operators in C.
Answer
Sign in to view the complete answer paper.
Write a C program to find biggest and smallest numbers from an array.
Answer
Sign in to view the complete answer paper.
Explain about the enumerated data type.
Answer
Sign in to view the complete answer paper.
Explain about storage classes in C.
Answer
Sign in to view the complete answer paper.
Explain the string handling functions in C.
Answer
Sign in to view the complete answer paper.
Write a program to implement the binary search.
Answer
Sign in to view the complete answer paper.