Skip to content
SmartFigureEdu

CS 3353 C Programming and Data Structures question paper, November/December 2022

Question Paper Code : 70073

B.E./B.Tech. DEGREE EXAMINATIONS, NOVEMBER/DECEMBER 2022.

Third Semester

Electrical and Electronics Engineering

CS 3353 — C PROGRAMMING AND DATA STRUCTURES

(Common to : Electronics and Communication Engineering/Electronics and Instrumentation Engineering/Electronics and Telecommunication Engineering/Instrumentation and Control Engineering)

(Regulations 2021)

Time : Three hoursMaximum : 100 marks

Answer ALL questions.

PART A — (10 × 2 = 20 marks)

  1. 1.

    What will be the output of the following program #include<stdio.h> int main() { float x = 0.1; if(x == 0.1) printf("IF"); else if(x == 0.1f) printf("ELSE IF"); else printf("ELSE"); }

  2. 2.

    Differentiate between prefix and postfix increment operator.

  3. 3.

    Define Enumerated Datatype.

  4. 4.

    State the purpose of Conditional compilation.

  5. 5.

    Specify the rules to be followed with respect to Priority Queues during insertion and deletion process.

  6. 6.

    List few applications of doubly linked list.

  7. 7.

    Write the post-order traversal and In-order Traversal for the below free [Figure: binary tree with root 10; 10 has children 20 and 30; 20 has children 7 and 4; 4 has left child 5; 30 has right child 60]

  8. 8.

    Define Separate Chaining.

  9. 9.

    What is the worst case runtime of insertion sort and specify the scenario?

  10. 10.

    List the disadvantages of linear search.

PART B — (5 × 13 = 65 marks)

  1. 11.
    (a)
    • (i)Write a program using control structure if....else that examines the value of an integer variable called rating and print one of the following messages, "Not recommended" - if the value of rating is less than 2 "Recommended' - if the value of rating lies between 2 and 4 "Highly recommended" - if the value of rating is above 4.(5)
    • (ii)Define Recursive Function in C and Write a program to print the numbers from 1 to 5 using recursive function.(4)
    • (iii)Predict the output of the following Program and state the reason intmain() { inti = 0; while(i<= 4) { printf("%d", i); if(i>3) gotoinside_foo; i++; } getchar(); return0;} voidfoo() { inside_foo: printf("PP");}(4)
  2. Or
  3. (b)
    • (i)Explain how multi-way selection "switch...case" statement implemented in c.(5)
    • (ii)Define Array and Explain how it can be declared, initialized and accessed by specifying the corresponding syntax.(4)
    • (iii)Define Loop. Write the syntax of any two loop statements in C.(4)
  4. 12.
    (a)
    • (i)Differentiate between Structure and Union(5)
    • (ii)Explain the various text file opening modes and their meaning in "C".(4)
    • (iii)With an example, show how to define a structure, create a structure variables and initialize it.(4)
  5. Or
  6. (b)
    • (i)Write a 'C' Program to find the sum of diagonal elements of the given matrix.(5)
    • (ii)Define Macro. Write a Macro to find the area of rectangle and use it in a C program.(4)
    • (iii)Write a 'C' program to find the largest element in an array using Pointers.(4)
  7. 13.
    (a)
    • (i)Define ADT and list the advantages of the same(5)
    • (ii)Devise an algorithm to perform push and pop operations in a Stack.(4)
    • (iii)List the advantages and disadvantages of representing a group of items as an array versus a linked list(4)
  8. Or
  9. (b)
    • (i)Write an algorithm to count the number of times a given int occurs in a linked list without Recursion.(5)
    • (ii)Convert the infix expression (X - Y / (Z + U) * V) into postfix expression (Step-By-Step Trace the values)(4)
    • (iii)Devise an algorithm to add 2 polynomials using doubly linked list.(4)
  10. 14.
    (a)
    • (i)Define Double Hashing and list the advantages of the same.(5)
    • (ii)Compare Separate Chaining with Open Addressing.(4)
    • (iii)State the properties of Binary trees.(4)
  11. Or
  12. (b)
    • (i)Write an algorithm to determine whether a binary tree is complete.(5)
    • (ii)Give an algorithm to count the number of nodes in a binary tree.(4)
    • (iii)Devise an algorithm to insert a node in a existing binary search tree.(4)
  13. 15.
    (a)
    • (i)List the steps for sorting the following numbers using merge sort {38, 27, 43, 3, 9, 82, 10)(5)
    • (ii)Perform heap sort on the following array of elements {9, 7, 5, 11, 12, 2, 14, 3, 10, 6) and produce the step by step procedure.(4)
    • (iii)Implement Binary Search on the following set of items {12, 18, 23, 25, 29, 32, 35, 40, 58, 66} and key = 18.(4)
  14. Or
  15. (b)
    • (i)Differentiate between linear search and binary search.(5)
    • (ii)Write an algorithm to perform quick sort for a sequence of elements.(4)
    • (iii)Explain the working principle of insertion sort with an example.(4)

PART C — (1 × 15 = 15 marks)

  1. 16.
    (a)
    • (i)Given two lists sorted in increasing order, create and return a new list representing the intersection of the two lists. The new list should be made with its own memory — the original lists should not be changed. A dummy node can be used to solve this. Example: Input : First linked list: 1->2->3->4->6 Second linked list be 2->4->6->8, Output: 2->4->6. The elements 2, 4, 6 are common in both the list so they appear in the intersection list. Develop a program to solve the above problem(10)
    • (ii)Find the time complexity of the following code and explain how it is obtained for (i=o; i<n; i++) { for (j=0;j<n;j++) { printf("Value of I = %d "+i); } }(5)
  2. Or
  3. (b)
    • (i)Develop a C program to read name and marks of n number of students from and store them in a file. If the file previously exits, add the information to the file.(8)
    • (ii)Design a C program to add two distances in inch-feet system using structure.(7)

Other CS3353 papers