Question Paper: Programming in C & Data Structures : Question Paper Dec 2015 - First Year Engineering (C Cycle) (Semester 2) | Visveswaraya Technological University (VTU)
0

## Programming in C and Data Structures - Dec 2015

### First Year Engineering (C Cycle) (Semester 2)

TOTAL MARKS: 100
TOTAL TIME: 3 HOURS
(1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks.
1 (a) Explain the structure of 'C' program with example.(8 marks) 1 (b) Explain scanf() and printf() function in 'C' language with syntax and examples.(8 marks) 1 (c) Write a 'C' program to find area of circle.(4 marks) 10 (a) Explain any 2 pre-processor directives in 'C' language.(5 marks) 10 (b) What is a STACK? Explain its applications.(5 marks) 10 (c) What is a QUEUE? Explain with example.(5 marks) 10 (d) Write a program to swap 2 numbers using call - by - reference method.(5 marks) 2 (a) What is an Algorithm? Write an algorithm to find largest of 3 numbers.(8 marks) 2 (b) Explain the following operators in 'C' language:
i) Relational ii) Logical iii) Conditional.
(8 marks)
2 (c) What is an Identifier? Give any 5 rules that are to be followed, while declaring a variable.(4 marks) 3 (a) Explain the ELSE-IF ladder with syntax and example.(8 marks) 3 (b) List the types of loops. Explain the working of any one type of loop with syntax and example.(8 marks) 3 (c) Write a program to read a year as an input and find whether it is a LEAP YEAR or not.(4 marks) 4 (a) Explain SWITCH statement, with syntax and example.(8 marks) 4 (b) Differentiate between WHILE and DO-WHILE loops.(6 marks) 4 (c) Write a program to find reverse of a number and check whether it is a PALINDROME or not.(6 marks) 5 (a) What is an ARRAY? Explain the different ways of initializing an array with examples.(7 marks) 5 (b) What are the advantages of using User-Defined functions?(6 marks) 5 (c) Write a program to read a sentence and print the frequencies of each VOWEL and total count of CONSONANTS.(7 marks) 6 (a) Explain the different types of arrays, with syntax and examples.(7 marks) 6 (b) Explain any 4 string manipulating functions with examples.(8 marks) 6 (c) Define the following: i) Actual parameter ii) Formal parameter iii) Global variable iv) Local variable.(5 marks) 7 (a) Define a STRUCTURE. Explain structure with syntax and example.(5 marks) 7 (b) What is a FILE? Explain any 2? FILE functions, with example.(5 marks) 7 (c) Write a program to maintain a record of ?n? student details using an array of structures with four fields (Roll number, Name, Marks and Grade). Each field is of a appropriate data type. Print the marks of the student give student name as input.(10 marks) 8 (a) Differentiate between STRUCTURES and UNIONS.(5 marks) 8 (b) Explain the various MODES in which a FILE can be created successfully.(5 marks) 8 (c) Given 2 university information files 'studentname.txt' and 'usn.txt' that contains students students Name and USN respectively. Write a program to create a new file called ?output.txt? and copy and contents of files 'studentname.txt' and 'usn.txt' into output file in the sequence shown below:

 Student Name USN Name - 1 USN - 1 Name - 2 USN - 2 . . . . . . . .
(10 marks) 9 (a) Define a POINTER. Explain how pointer variable is declared and initialized.(6 marks) 9 (b) What are primitive and non-primitive data types? Give examples.(6 marks) 9 (c) Write a program using pointers to compute sum. Mean and standard deviation of all elements stored in an array of 'n' real numbers.(8 marks)