Basic Programming Concept Using C 2016 – BSc Computer Science Part 1

Paper Code: 13506
1506
B.Sc. (Computer Science) (Part 1)
Examination, 2016
Paper No. 2.3
BASIC PROGRAMMING CONCEPTS USING C

Time: Three Hours] [Maximum Marks: 34

 

Note: Attempt five questions in all selecting at least one question from each Section.

Section-A

1. (a) What are header files and what are its uses in C programming?

(b) What are variables and it what way is it different constants?

2. (a) Differentiate between local and global variables.

(b) How do you declare a variable that will hold string values?

3. (a) What is scope of variable? How are variables scoped in C?

(b) Write a C program to compute the sum of first n terms of the series using ‘for’ loop.

1+3+5+7+9.............

4. (a) What are the control structures in C? Give an example each.

(b) When should we use pointers in a C program?

Section-B

5. (a) When is a “switch” statement preferable over an “if” statement?

(b) Write a loop statement that will show the following output:

1

1       2

1       2       3

1       2       3       4

1       2       3       4       5

6. (a) What is the difference between functions getch() and getche()?

(b) What are structure types in C?

7. (a) Explain any two dynamic memory allocation functions.

(b) Describe, how arrays can be passed to a user defined function.

8. (a) What is the difference between declaration and definition of a function?

(b) Write a C function is prime (num) that accepts an integer argument and returns 1 if the argument is prime, a0 oterwise. Write a C program that invokes this function to generate prime numbers between the give ranges.

Section-C

9. (a) What is a file? Explain, how the file open and file close functions handled in C?

10. What is the output of this C code?

#include<stdio.h>

int main ()

{

int a[5] = {1,2,3,4,5};

int i;

for (i=0;i<5:i++)

if ((char) a[i] = = ‘5’)

printf(“%d/n”, a[i]);

else

printf(“FAIL/n”);

}

………End………

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.