Computer Programming – BE (TU) Question Paper 2071 | First Semester
Tribhuvan University
Institute of Engineering
Examination Control Division
Year: 2071 (Chaitra)
Exam: Regular / Level: BE (Bachelor of Engineering) / Program: All (Except B.Arch)
Year/Part: I / I (First Semester) | Full Marks: 80 | Pass Marks: 32 | Time: 3 Hrs
Subject ? Computer Programming (CT401)
- Candidates are required to give their answer in their own words as far as practicable.
- Attempt All Questions.
- The figures in the margin indicate Full Marks.
- Assume suitable data if necessary.
- a) What is mean by compilation? What is meant by interpretation? How do these two processes differ? [4]
b) Define programming language? What are the features of good computer program? [1 + 3] - a) What are preprocessor directives? Explain constants and variables. [2 + 2]
b) Write syntax and example of following statements/functions: [1 X 4]
i) printf
ii) getch
iii) scanf
iv) long - What are control statements? Illustrate nested IF statement with its flowchart. Write a program to calculate the series: 1 X 10 + 3 X 20 + 6 X 30 + . + N (N + 1) / 2 X 10 N, where N is an integer term read from the keyboard. [ 2 + 2 + 6]
- a) Write a program to display Armstrong numbers between the range entered by a user and also display their counts. You must use a function to check for Armstrong numbers and display them from main. [4]
b) What do you mean by nested function and recursive function? Give an example of recursive function. [2 + 2] - a) Write a C program to read a string and display its reverse. Use user defined function to count number of characters in it and to reverse it. [4]
b) Write an algorithm to insert a value in an array at a position given by user. [4] - a) What is a tag? Must a tag be included in a structure type definition? Must a tag be included in a structure variable declaration? Explain. [1 + 1 + 2]
- Illustrate with example that ?Array is indirectly a pointer?. Write program to calculate sum and average of integer numbers between M and N (where value of M and N are read from keyboard) using pointer. [4 + 4]
- Write a program to continuously read name, age and salary of a worker and write it into file until user confirms to end. Then read n from user and display the nth record in the file. Details of worker must be represented by a structure. [7]
- a) Compare arithmetic and logical if statements in FORTAN. [7]
b) Write a FORTAN program to display nature of roots of a quadratic equation. Calculate and display the roots, if they are real and equal. [8]