Tribhuvan University
Bachelor of Science in Computer Science and Information Technology
Semester 1 · TU Board 2079
Course Title: C Programming (CSC115)
Full Marks: 60Pass Marks: 24Time: 3 hours
Candidates are required to give their answers in their own words as far as practicable. The figures in the margin indicate full marks.
Group A
(2 × 10 = 20)
- 1.10
What is the difference between exit(0) and exit(1)? Discuss the need of nested structue with an example. Write a program to find the value of x^y without using POW code.
- 2.10
Why do we need a break and continue statement? Define formal argument and actual argument in function with examples. Identify and list the errors in the following code.
int main(){ int a,b,c scanf("%d%d%d, &a, &b, &c); sum(a, b, c); return -1; } void sum(int x, int y, int z){ int sum; sum = a + b + c; return sum; } - 3.10
Write a program to demonstrate the following menu-driven program. The user will provide an integer and alphabet for making choice and the corresponding task has to be performed according as follow:
- Find Odd or Even
- Find Positive or Negative
- Find the Factorial value
- Exit
The choice will be displayed until the user will give "D" as a choice.
Group B
(8 × 5 = 40)
- 4.5
How do you swap the values of two integers without using the third temporary variable? Justify with the example.
- 5.5
Write a program to find the sum of digits of a given integer using recursion.
Answer comingAlso asked in 2074
- 6.5
Differentiate between constant and literals. Why do we need to define the type of data?
- 7.5
Write a program to find the second largest number in the given array of numbers.
- 8.5
Create a structure "Employee" having Name, Address, Salary, and Age as member functions. Display the name of the employee having aged between 40 and 50 are living in Kathmandu.
- 9.5
List any one advantage and disadvantage of the pointer. How do you pass pointers as function arguments?
- 10.5
Suppose a file named "Num.txt" contains a list of integers. Write a program to extract the prime numbers only from that file and write them on "Prime.txt" file.
- 11.5
What is the advantage of the union over structure? List any four-string library functions with the prototype.
- 12.5
Write short notes on
- Local, Global, and Static variables
- Conditional Operator
— The End —