You are on page 1of 3

B.

TECH
(SEM. I) (ODD SEM) THEORY EXAMINATION, 2015-16
Computer System and Programming in C
Code: NCS-101
Time: 3 Hours

[Total Marks: 100]

Section-A
Q.1 Attempt all parts. All parts carry equal marks. Write answer of each part in short.
(2x10 = 20)
(a) What are the different characteristics of computers?
(b) What is the difference between 'call by value' and 'call by reference'?
(c) State the correct output for the following program:
void main( )
{
int I;
for(i=1;i<=10;i++)
{
If(i%2==0)
Continue;
printf(%d,i);
}
}
(d) What are pointers? How are they declared?
(e) What are the various bitwise operators in C language?
(f) Explain different kinds of iterative loops?
(g) Differentiate between (a) typecasting and type conversion, (b) while and do-while, (c)
printf and scanf, (d) structure and union?
(h) Differentiate between primary memory and secondary memory.

(i) Convert the following into decimal: (a) (10110101)2 (b) (5674)8 (c) (A1E2)16 (d)
(101101.00101)2
(j) State the correct output for the following program.
#include
void main()
{
int i=0,j=1,k=2,l;
l=i&&j++||k++
printf(Result is :\n);
printf(%d%d%d%d,i,j,k,l);
}
Section-B
Note: Attempt any five parts. All parts carry equal marks: (510=50)
Q.2 Define algorithm and flowchart. Draw a flowchart and write an algorithm to
calculate the sum of first 50 natural numbers?
Q3. Give the difference between parameter passing methods in functions with
example. Write a program to swap two numbers using different methods.
Q4. Write a program to find the sum of series:
S = 1+ (1+2) + (1+2+3) + (1+2+3+4) +n terms.
Explain with example the arrays of unknown or varying size, and where these are
used.
Q5. A number is said to be an Armstrong number if the sum of the cube of its digit is
equal to the number itself. For example, 153 is an Armstrong number as 153 = 1 3 + 53
+ 33 . Write a C program to check whether a given number is Armstrong or not.
Q6. An integer is said to be perfect number if its factors (including 1) sum to the number.
For example, 6 is a perfect number as 6 = 1+2+3. Write a C program to check whether
a given number is perfect or not.
Q7. Write a menu-driven program to perform :
1. Factorial of a number.
2. Prime or not
3. Odd or even
4. Exit
Once a menu item is selected the appropriate action should be taken and once this action is
finished, the menu should reappear. Unless the user selects the 'Exit' option the program
should continue to work.

Q8. Give the difference between break and continue statements with the help of suitable
example.
Q9. Write an algorithm for selection sort. Explain its working for sorting 12, 8, -6, 2, 4, 5, 3,
7, 4, 2.

Section-C
Note: Attempt any two questions from this section. (215=30)
Q10. (a)Write a function to evaluate exp(x) = 1+x+x2/2!+x3/3!+..
(b) Write a function that implements a linear search method to find an item in a
given array of integers.
(c) What happen if in a program segment, the number of else clauses are more
than the number of if clauses? Will the compiler be able to solve this problem
without user intervention?
Q11. (a) State the features of arrays. Write a C program to sort a given number using
pointers.
(b) List out various file operations in .C. Write a C program to count the number of characters
in a file.
(c) Write a simple database program in C which stores personal details of 100 persons such as
Name,
Date of Birth, Address, Phone number etc.
Q12. (a) Write a C program to store the student details using union.
(b) What do you mean by dynamic memory allocation? Explain the following function in
detail
(i) free (ii) calloc
(c) Describe about the basic components of computers with a neat block diagram.

You might also like