JNTU
JNTU B.Tech I PROGRAMMING FOR PROBLEM SOLVING Previous Question Paper (July/August - 2021 - R18)
Answer any five questions. All questions carry equal marks.
Main
Differentiate between typecasting and type conversion.
Answer
Type conversion (also known as implicit conversion) is performed automatically by the compiler when data types are compatible. For example, when assigning a smaller integer type to a larger floating-point type, the compiler promotes the value without loss of data. It follows the standard hierarchy of data types to prevent data loss.
Typecasting (also known as explicit conversion) is a user-defined process where the programmer forces a value to be converted into a specific type using the cast operator (type). This is necessary when converting from a larger type to a smaller type, which may result in data loss or truncation, or when performing floating-point division using integer variables.
Write a program to count the number of vowels in a text.
Answer
The following C program counts the number of vowels in a string provided by the user:
#include <stdio.h>
#include <string.h>
int main() {
char str[100];
int count = 0, i;
printf("Enter a string: ");
fgets(str, sizeof(str), stdin);
for(i = 0; str[i] != '\0'; i++) {
char ch = str[i];
if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ||
ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') {
count++;
}
}
printf("Number of vowels: %d\n", count);
return 0;
}Write a program to read two numbers. Then find out whether the first is a multiple of the second number.
Answer
Sign in to view the complete answer paper.
Explain the use of Command line argument with an example.
Answer
Sign in to view the complete answer paper.
Describe about the enumerated data type with an example.
Answer
Sign in to view the complete answer paper.
Explain about the use of pointers in self referential structures.
Answer
Sign in to view the complete answer paper.
Write a program to transpose of a 3×3 matrix.
Answer
Sign in to view the complete answer paper.
Differentiate between structure and an array.
Answer
Sign in to view the complete answer paper.
Explain the importance of #define preprocessor directive.
Answer
Sign in to view the complete answer paper.
Write a program to read a file that contains lowercase characters. Then write these characters into another file with lower case characters converted into upper case.
Answer
Sign in to view the complete answer paper.
Write a program to merge two files into a third file. The names of the files must be entered using command line arguments.
Answer
Sign in to view the complete answer paper.
Distinguish between #ifdef and #ifndef.
Answer
Sign in to view the complete answer paper.
Write a recursive program to find out the factorial of given number.
Answer
Sign in to view the complete answer paper.
Explain about the dynamic memory allocation.
Answer
Sign in to view the complete answer paper.
Write an algorithm to find out the minimum and maximum numbers of a given set.
Answer
Sign in to view the complete answer paper.
Explain about the Bubble sort with an example.
Answer
Sign in to view the complete answer paper.