EbookNepal.COM

BIM (TU) Question Paper 2014 – Structured Programming | Second Semester

Tribhuvan University | Faculty of Management
BIM / Second Semester / IT 213: Structured Programming
Year: 2014 (2071)

Full Marks: 40 | Time: 2 hrs

Candidates are required to answer all the questions in their own words as far as practicable.

Group ?A? – 1. Brief Answer Questions: [10 X 1 = 10]

i. When will you use structure variable?
ii. Is the use of ternary operator ( ? : ) alternative option of using if?else statement?
iii. Write syntax of fopen function.
iv. What is the problem/error in following part of the C program?

main()
{
int array_size=200;
float marks[array_size];
return 0;
}

v. What is the output of the following program?

main()
{
float a[ ] = {10.5 ,2.6,3.7,4.6,5.1,6.6};
float *ptr = a+2;
printf(?\n*ptr=%f and *(ptr+1)=%f?,*ptr,*(ptr+1));
return 0;
}

vi. What is the output of the following program?

main()
{
Int n=10;
pringf(?\n n=%d?,n);
printf(?n=%d?,n++);
printf(?\n n=%d?,++n);
printf(?\n n=%d?,n);
return 0;
}

vii. When is static variable used?
viii. What happens when you assign a fractional number to an integer variable?
ix. Why is else statement used?
x. List out two main function of return statement in function definition.

Group ?B? – Short Answer Questions: [5 X 3 = 15]

2. Write program that takes an integer number from user, and displays message ?welcome? if the given integer number is of four digits only otherwise displays ?rejected?.
3. Write function that displays factorial on number 7 only.
4. Write program that takes a string from user and displays the length of that string.
5. Write a program to display following pattern.

* #
* #
* ? ?
* ? ? +

6. What do you understand by function call by value and call by reference? Write program to illustrate both types of function cal.

Group ?C?- Long Answer Questions: [3 X 4 = 12]

7. Write function that takes a string from user, if the length of string is 7 then it displays the middle character of that string and function returns, otherwise user is asked to input another string.
8. Write program that stores information of students in a file. In this file new records of students can be added without affected existing records of students. Students have name, are and address as attributes.
9. Write program which displays sum of all elements of two different 3-D integer arrays.