TRIBHUVAN UNIVERSITY
INSTITUTE OF SCIENCE AND TECHNOLOGY
2079 B.S.
Candidates are required to give their answers in their own words as far as practicable.
Group A
Long Answer QuestionsAttempt any Two questions.
- 1Difference between exit(0) and exit(1)? Discuss need for nested structure. Write program to find $x^y$ without using the POW function.
- 2Why do we need break and continue? Define formal and actual arguments. Identify and list errors in provided sum function code.
- 3Write a menu driven program for: A. Odd/Even B. Positive/Negative C. Factorial D. Exit. Repeat until choice D.
Group B
Short Answer QuestionsAttempt any Eight questions.
- 4How do you swap two integers without a third variable? Justify with example.
- 5Write a program to find the sum of digits of a given integer using recursion.
- 6Differentiate between constant and literals. Why do we need to define data types?
- 7Write a program to find the second largest number in a given array.
- 8Create structure 'Employee' (Name, Address, Salary, Age). Display employees aged 40-50 living in Kathmandu.
- 9List advantage/disadvantage of pointers. How do you pass pointers as function arguments?
- 10Write a program to extract prime numbers from 'Num.txt' and write them to 'Prime.txt'.
- 11What is the advantage of union over structure? List four string library functions with prototypes.
- 12Write short notes on: a. Local, Global, and Static variables b. Conditional operator ($?:$).