Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

Programming for Problem Solving Using c Aug 2022

The document contains examination questions for the I B. Tech II Semester in Programming for Problem Solving using C, covering various topics across five units. Each unit includes multiple questions focusing on concepts such as data types, operators, control statements, arrays, pointers, functions, and file handling in C programming. Students are required to answer five questions, selecting one from each unit, with all questions carrying equal marks.

Uploaded by

arjunkumar882005
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Programming for Problem Solving Using c Aug 2022

The document contains examination questions for the I B. Tech II Semester in Programming for Problem Solving using C, covering various topics across five units. Each unit includes multiple questions focusing on concepts such as data types, operators, control statements, arrays, pointers, functions, and file handling in C programming. Students are required to answer five questions, selecting one from each unit, with all questions carrying equal marks.

Uploaded by

arjunkumar882005
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Code No: R201204 R20 SET - 1

I B. Tech II Semester Regular/Supplementary Examinations, August- 2022


PROGRAMMING FOR PROBLEM SOLVING USING C
(Com. to CE, Agri E)
Time: 3 hours Max. Marks: 70
Answer any five Questions one Question from Each Unit
All Questions Carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UNIT-I
1. a) With an example, explain the representation of unsigned and signed integers in (7M)
computer memory.
b) Explain different types of scopes supported in C programming. (7M)
Or
2. a) How are the expressions evaluated in C? With an example, explain the role of (7M)
precedence and associativity rules in evaluating an expression in C programming.
b) What is the use of command line arguments in C programming? Explain with an (7M)
example C program.
UNIT-II
3. a) Explain about Logical Bitwise Operators in C programming. (7M)
b) Evaluate the following C expression b = 4 * 6 + 3 * 4 < 4*5 ?4 : 3 (7M)
and explain the concepts used in it.
Or
4. a) Give the syntax of switch statement in C programming. Explain the usage of (7M)
‘default’ case and ‘break’ statement.
b) Write a C program to print the number pyramid as shown below for input 4. (7M)
1
2*2
3*3*3
4*4*4*4
4*4*4*4
3*3*3
2*2
1
UNIT-III
5. a) How to declare, initialize and access arrays in C? Give example. (7M)
b) (7M)
What is the output of the following C code? Give Explanation.
#include <stdio.h>
int main()
{
int i,j,k;
int arr[]={1,2,3,4,5,6};
j=++arr[2];
k=arr[1]++;
i=arr[j++];
printf(“i=%d, j=%d, k=%d”, i, j, k);
return 0;
}

1 of 2
|''|''|||''|'''|||'|
Code No: R201204 R20 SET - 1

Or
6. a) Why do we use enumerated data type in C? Write a C program to demonstrate the (7M)
usage of enumerated data type.
b) Why do we need to create nested structures in C programming? Explain with an (7M)
example C program.
UNIT-IV
7. a) What are pointers in C programming? Mention the advantages and disadvantages (7M)
of using pointers.
b) Write about lvalue and rvalue in pointer expressions. (7M)
Or
8. a) Explain the concept of pointer to pointers with a sample C program. (10M)
b) Does preprocessor run before compiler? Give explanation. (4M)

UNIT-V
9. a) Explain the following (7M)
(i) Function prototype
(ii) Actual and Formal parameters
b) Write a C program to find the GCD of two numbers using recursive functions (7M)
Or
10 a) Write about various standard library Input / Output functions for processing files (7M)
in C.
b) Write a C program to convert a Binary File into a Text File (7M)

2 of 2

|''|''|||''|'''|||'|
Code No: R201204 R20 SET - 2
I B. Tech II Semester Regular/Supplementary Examinations, August- 2022
PROGRAMMING FOR PROBLEM SOLVING USING C
(Com. to CE, Agri E)
Time: 3 hours Max. Marks: 70
Answer any five Questions one Question from Each Unit
All Questions Carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UNIT-I
1. a) How are real numbers represented in computer memory? Explain with an (7M)
example.
b) Explain in detail about the types of Storage classes in C programming. (7M)
Or
2. a) Why do we need type conversion? Explain about the types of data conversions in (7M)
‘C’ programming.
b) Explain in detail the prototype of ‘scanf’’ function in C programming, including (7M)
its argument list and return type.
UNIT-II
3. a) What are the various sized integer data types in C? Explain with example. (7M)
b) Write a C program to read any day number in integer and display day name in the (7M)
word. ( For the Input: 4 Expected Output : Thursday)
Or
4. a) Discuss various Conditional Control statements in C programming. (7M)
b) Write a C program to print the number pyramid as shown below for input 4. (7M)
12344321
123**321
12****21
1******1
UNIT-III
5. a) With a neat sketch, explain the memory representation of single and multi (10M)
dimensional arrays in C programming.
b) What is the output of the following C code? Give Explanation. (4M)
#include <stdio.h>
int main()
{
int i;
int arr[3]={3};
for ( i=0; i<3;i++)
printf(“%d”, arr[i]);
return 0;
}

1 of 2

|''|''|||''|'''|||'|
Code No: R201204 R20 SET - 2

Or
6. a) Write the differences between enumerated data types and macro in C (7M)
programming.
b) Give the syntax of Union in C programming? What are the constraints of using (7M)
Unions? List out the merits and demerits of using Unions.

UNIT-IV
7. a) What is a Pointer in C? What is the use of Pointers? Explain the syntax for (7M)
accessing a pointer in C.
b) Explain the differences between an array of characters and a character pointer. (7M)
Or
8. a) Write a C program to access the values of an array of integers using pointer. (7M)
b) What is dangling pointer with example? Why dangling pointers are dangerous? (7M)
How do you solve dangling memory problems?

UNIT-V
9. a) Why we need functions in C? Explain about predefined and user defined functions (7M)
in C.
b) Write a C program to swap the values of two variables using functions. (7M)
Or
10 a) (7M)
Explain the ‘fprintf()’ formatted output function.
.
b) Explain about text and binary streams in C programming. (7M)

2 of 2

|''|''|||''|'''|||'|
Code No: R201204 R20
1 of 1 SET - 3
I B. Tech II Semester Regular/Supplementary Examinations, August- 2022
PROGRAMMING FOR PROBLEM SOLVING USING C
(Com. to CE, Agri E)
Time: 3 hours Max. Marks: 70
Answer any five Questions one Question from Each Unit
All Questions Carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UNIT-I
1. a) What is the importance of number system in computer? Briefly describe the four (7M)
types of number system used in computers.
b) Write a C program to demonstrate the significance of ‘static’ storage class. (7M)

Or
2. a) Explain the significance of precedence and Associativity rules in evaluating a ‘C’ (7M)
expression.
b) How to run a C program from command line arguments? Give example. (7M)
UNIT-II
3. a) Write about Shift Operators in C programming. (7M)
b) What is the output of the following C code? Give Explanation. (7M)
#include <stdio.h>
int main()
{
int a=10, b=3, c=2, d=4, result;
result = a+a*-b/c%d+c*d;
printf("%d”, result");
return 0;
}
Or
4. a) Explain about pretest and post-test loops in C programming with necessary (7M)
flowcharts.
b) Write a C program to print the number pyramid as shown below for input 5. (7M)
55555
45555
34555
23455
12345
UNIT-III
5. a) Describe the storage structure of an array, and give the memory representations (10M)
of various types of arrays.
b) An integer array of size 15 is declared in a C program. The memory location of the (4M)
first byte of the array is 2000. What will be the location of the 13th element of the
array? Assume int data type takes 2 bytes of memory.
Or
6. a) What are the uses of Self-referential structures? Demonstrate the usage of Self (7M)
referential structures with an example C program.
b) Define Union. Write a C program to illustrate the declaration, initialization and (7M)
accessing of Union members.
1 of 2
|''|''|||''|'''|||'|
Code No: R201204 R20 SET - 3

UNIT-IV
7. a) How to declare, initialize and access pointers in C programming? (7M)
b) Explain the difference between char *S and char S[] with a sample C program (7M)
Or
8. a) Write about preprocessor directives in C programming. (7M)
b) Explain the output of the following C code. (7M)
#include<stdio.h>
void test(char c[])
{
c=c+2;
c--;
printf("%c",*c);
}
int main()
{
char ch[5]={'p','o','u','r'};
test(ch);

return 0;
}
UNIT-V
9. a) What is Recursive Function? What are the constraints for defining a Recursive (7M)
function? Explain with an example.
b) What are various types of parameters passing techniques in ‘C’ programming? (7M)
Explain with an example.
Or
10 a) Explain in detail about character input/output functions supported by C. (7M)
.
b) What do you mean by stream in C language? Discuss various types of streams (7M)
supported in C programming.

2 of 2

|''|''|||''|'''|||'|
Code No: R201204 R20 SET - 4
I B. Tech II Semester Regular/Supplementary Examinations, August- 2022
PROGRAMMING FOR PROBLEM SOLVING USING C
(Com. to CE, Agri E)
Time: 3 hours Max. Marks: 70
Answer any five Questions one Question from Each Unit
All Questions Carry Equal Marks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UNIT-I
1. a) Explain the process of creating, compiling and executing a C program. (7M)
b) How are real numbers stored in computer memory? What is the effect of (7M)
normalization on the accuracy of real number representation? Explain with an
example.
Or
2. a) Explain the importance of each storage class specifiers in C programming. (7M)
b) Write a C program to find the sum of numbers given in command line arguments. (7M)

UNIT-II
3. a) Explain about Bitwise and Logical operators in C programming with necessary (7M)
examples.
b) Write a program in C to read any Month Number in integer and display Month (7M)
name in the word. (for input: 4, Expected Output : April)
Or
4. a) With a sample C program, demonstrate the usage of Event and Counter Controlled (7M)
Loops.
b) Write a C program to print the number pyramid as shown below for input 5. (7M)
1
21
321
4321
54321
UNIT-III
5. a) Write a C program to find the sum of all elements of each row of a matrix. (7M)
Example: For a matrix
456
673
123
The output will be
15
16
6
b) How are strings stored and accessed in C programming? Why a string is always (7M)
terminated with a null character? Explain.
Or
6. a) Demonstrate the memory allocation strategy for Unions and Structures in C (7M)
programming.
b) Write a short note on enumerated types in C programming with syntax and (7M)
example.
1 of 2

|''|''|||''|'''|||'|
Code No: R201204 R20 SET - 4

UNIT-IV
7. a) Write a C program to demonstrate the difference between pointer to an integer (7M)
array and pointer to an array of integers.
b) How does pointer arithmetic work? What is the role of lvalue and rvalue in pointer (7M)
arithmetic?
Or
8. a) What do you mean by Scale factor in C programming? Explain the output of the (7M)
following C code snippet.

#include <stdio.h>
int main()
{
int var, *ptr;
ptr = &var;
printf("The address of ptr before increment: %u\n",ptr);
++ptr;
printf("The address of ptr after increment: %u\n",ptr)
}
b) List and explain various memory allocation functions in C programming. (7M)
UNIT-V
9. a) How to declare, define and call a user defined function in C language? Explain (7M)
with an example.
b) Write a C Program to print Binary Equivalent of an Integer using Recursion (7M)
Or
10 a) Write a program in C language to read the data from a text file and store the lines (7M)
. into an array.
b) How do text streams and binary streams differ in C? (7M)

2 of 2

|''|''|||''|'''|||'|

You might also like