Ay20 21 - R18e1 Sem 1 - Mid 2 - Ece PDS 30072021

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

RGUKT RK Valley (Idupulapaya)

Rajiv Gandhi University of Knowledge Technologies - Andhra Pradesh


Academic Year 2020– 21: Semester I
Mid Semester Test-II

Electronics & Communication Engineering/ Electrical & Electronics Engineering/Civil


Engineering
CS1109- Programming & Data Structures
R18 Batch & Regular Mode of Examinations

Year: ENGG-1 Date of Examination: 30 JULY 2021


Time: 120 Minutes Max Marks: 40
---------------------------------------------------------------------------------------------------------------------

4X10 Marks= 40
The Question Paper Consists of 8 questions. Answer any 4 questions
Each Question Carries 10 Marks and may have ‘A’, ‘B’ as two sub-questions
Note (if any): Usage of any data/ Scientific calculator/code book may be permitted/not
permitted.
***

1 A. What are the operators that I have used in the given code & explain the purpose of them.
What would be the output ?? Give an explanation for it . (4M )
#include<stdio.h>
main( )
{
char *name = “RGUKT” , *place = “RKVALLEY”;
printf( “ %s %c” , &*&*name , *place );

B. Define Dynamic Memory Allocation . what is the purpose of it & explain the methods
used for dynamic allocation? .

2. Define the following with an example: (2M….. for each)

i. void pointer ii . wild pointer iii. Double pointer iv . Dangling pointer v . Null
pointer
3. 3 6 9
A
7 5 8

2 1 0

From the above data ,

I . Write the pointer expression for displaying element 5 ? 1M

II. Assume the name given for above table is A, What would be the result of expression

(*(A + 2) + 1 ) 1M

III. Interpret the expression *(*A + 1)+2 in step-by-step manner & find the equivalent
subscript expression for it. 2M

IV. Derive the result for the expression *(*(A+1)+2). 1M

B . Explain the difference in between Call by value & Call by Reference with an example
?Why should we have to choose call by reference over call by value. 5M

4. From the expression A * ( B + C ) / D . Evaluate prefix , postfix & infix Notation.


Assume the values of A , B , C & D are of 4 , 2 , 8 , 5 . Evaluate the expression by using
stack.

5. Define Stack & Linked List .Write a program to perform insertion & deletion of a node to
and from the single Linked List.

6. A . List out three differences in between Structure & Union with an example . 6M

B . Explain strcpy( ) with an example .What would be the output for the following code. If
used union instead of structure data type, what would be the changes that take place ?
4M

#include<stdio.h>
#include<string.h>

struct student
{
char name[20];
}std;

char *example(struct student *temp)


{
strcpy(temp -> name , “anonymous”);
return temp -> name;
}
main( )
{
strcpy(std.name,”UNKNOWN”);
printf(“ %s %s ” , std.name , example( &std ));
}

7. Write a program to define a structure for a book that has members- author, name, type,
publisher.
a. Display the details of a book i.e., author, name, type, publisher
b. Write a function to display the count of books belong to a particular type
c. Write a function to search the book through the author or book name or publisher.

8. A. Define an error . What is syntax & logical error .

B. What you have learnt through the course Programming in C & Data Structure. Explain
in brief about the purpose of each Unit.

You might also like