JNTU

JNTU B.Tech I PROGRAMMING FOR PROBLEM SOLVING Previous Question Paper (July/August - 2021 - R18)

B.Tech | I | I-II | R18 | July/August - 2021

Answer PaperPaper Code: 152AFMaximum Marks: 75Time: 3 Hours

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

Differentiate between typecasting and type conversion.

7 marks

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.

b

Write a program to count the number of vowels in a text.

8 marks

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;
}
215 marks
a

Write a program to read two numbers. Then find out whether the first is a multiple of the second number.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain the use of Command line argument with an example.

7 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

Describe about the enumerated data type with an example.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain about the use of pointers in self referential structures.

8 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

Write a program to transpose of a 3×3 matrix.

8 marks

Answer

Sign in to view the complete answer paper.

b

Differentiate between structure and an array.

7 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

Explain the importance of #define preprocessor directive.

7 marks

Answer

Sign in to view the complete answer paper.

b

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.

8 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

Write a program to merge two files into a third file. The names of the files must be entered using command line arguments.

8 marks

Answer

Sign in to view the complete answer paper.

b

Distinguish between #ifdef and #ifndef.

7 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

Write a recursive program to find out the factorial of given number.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain about the dynamic memory allocation.

7 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Write an algorithm to find out the minimum and maximum numbers of a given set.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain about the Bubble sort with an example.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of PROGRAMMING FOR PROBLEM SOLVING from JNTU for B.Tech IT I I-II, July/August - 2021, R18.

For the question paper without answers, switch to the Question Paper tab.

Other papers in PROGRAMMING FOR PROBLEM SOLVING

Loading Question Papers

Fetching data from database...