Pokhara University
Bachelor of Engineering in Computer Engineering
Semester 1 · PU Spring 2023
Course Title: Programming In C
Full Marks: 100Pass Marks: 45Time: 3hrs.
Candidates are required to give their answers in their own words as far as practicable.
- 1.15
- a) What are the properties of a good algorithm? Write an algorithm and = draw a neat flowchart to input a number and check whether it is even and divisible by 3.
- b) Write the rules of naming variables. How is a variable declared and initialized in compile time and run time? Explain with example.
- 2.15
- a) How does else-if ladder work? Explain with its general syntax, flowchart and a simple program.
- b) Compute the total labor cost for building wall of 50 meter long, 0.2 meter wide and 7 meter tall. The length of a brick is 10cm, height is 8cm and width is 6cm. Cost of one brick join in 1.50 paisa. (Assume the thickness of mortar is negligible.)
- 3.15
- a) Write a program to find the sum of n terms of the series : Levttt........4x", by asking the values of and x from user.
- b) What is the advantage of an array over a variable? Write a program to read 4x4 matrix, compute and print the sum of all elements.
- 4.8
- a) What are the header files? Explain their roles in a program. 9.
- b) What is a recursive function? Write a recursive function to generate the 10 terms of Fibonacci sequence starting from 0 as first term and | as second term.
- 5.7
- a) Write a program to pass the elements of an array to a function using pointer and use the function to find the sum of the elements and print the sum.
- b) How is memory allocated dynamically in C? Explain with a simple = g program. cs ee Steere 1
- 6.15
- a) Create a structure called student with data members name, rollno and college for 10 students. Display the name of the students who study at SoE.
- b) What are the different file opening modes? Explain the role of FILE pointer, fopen (), and fclose () functions with a simple program.
- 7.
Write short notes on: (Any two) 2x5
- a) Programming Languages
- b) String Functions
- c) Advantages of Functions Leper 2
— The End —