Jaypee University of Information Technology 2022 Programming Exam PDF

Summary

This is a programming exam from Jaypee University of Information Technology, 2022. The exam includes several questions requiring C programming solutions, such as simulating Tower of Hanoi and generating Fibonacci numbers.

Full Transcript

## JAYPEE UNIVERSITY OF INFORMATION TECHNOLOGY, WAKNAGHAT TEST-2 EXAMINATION-2022 B.Tech-I Semester (All Branches) **COURSE CODE (CREDITS):** 19B11CI111 (2) **MAX. MARKS:** 25 **COURSE NAME:** PROGRAMMING FOR PROBLEM SOLVING-II **COURSE INSTRUCTORS:** Dr.@{Pardeep, Ravindara, Amol, Amit, Avni, Nish...

## JAYPEE UNIVERSITY OF INFORMATION TECHNOLOGY, WAKNAGHAT TEST-2 EXAMINATION-2022 B.Tech-I Semester (All Branches) **COURSE CODE (CREDITS):** 19B11CI111 (2) **MAX. MARKS:** 25 **COURSE NAME:** PROGRAMMING FOR PROBLEM SOLVING-II **COURSE INSTRUCTORS:** Dr.@{Pardeep, Ravindara, Amol, Amit, Avni, Nishant & Vikas} **MAX. TIME:** 1 Hour 30 Min **Note:** All questions are compulsory. Marks are indicated against each question in square brackets. Do not use advanced topics like arrays etc. while answering programming questions **Q1**. Consider Tower of Hanoi puzzle for N disks and three rods (A,B and C) with the following rules: - The objective of the puzzle is to move the entire stack(here considered A) to another rod (here considered C), obeying the following simple rules: - Only one disk can be moved at a time. - Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack. - No disk may be placed on top of a smaller disk. - Write a program in C to the solution of this puzzle for N Disks. Do the dry run of your program for 3 disks. **[CO-4] [5+2]** **Q2**. The Fibonacci numbers are the numbers in the following integer sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ........ Write a program in C using for loop to print the sequence of series up to n terms entered by the user. **[CO4] [3]** **Note:** Do not use user defined functions while answering. **Q3**. Write a program in C to compute the sum of digits of a 5 digit number entered by the user using call by value and call by reference logic. **[CO-5 & CO6] [2.5+2.5]** **Q4**. What do you mean by actual and formal arguments? Mark them in a simple C program. Write and justify your output for the following code segment: int a = 1; printf ("%d %d %d", a, ++a, a++); **[CO-5] [2+3]** **Q5**. Write a program in C to display the pattern like right angle triangle as shown below: ``` 1 12 123 1234 ....... ``` The number of rows is to be entered by the user. **[CO4][5]**

Use Quizgecko on...
Browser
Browser