VTU 1ST SEM PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPERS OF JUNE-2015 & DECEMBER-2015

Post on 21-Jan-2017

1.222 views 12 download

Transcript of VTU 1ST SEM PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPERS OF JUNE-2015 & DECEMBER-2015

SOLVED PAPERS

OF

PROGRAMMING IN C &

DATA STRUCTURES

(JUNE-2015 & DECEMBER-2015)

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

1

1 a. What are data types? Mention the different data types supported by C language,

giving an example to each. (5 Marks)

Ans:

1 b. Write a C program which takes as input p, t, r. Compute the simple interest and

display the result. (5 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

2

1 c. What is an operator? List and explain various types of operators. (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

3

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

4

2 a. What is a token? What are the different types of tokens available in C language?

Explain. (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

5

2 b. Write C expressions corresponding to the following (Assume all quantities are of

same type) (06 Marks)

Ans:

2 c. What is the value of ‘x’ in the following code segments? Justify your answers:

(06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

6

3 a. What are the different types of conditional decision making statements? Explain

each with example. (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

7

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

8

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

9

3 b. Write a C program to simulate simple calculator that performs arithmetic

operations using switch statements. Error message should be displayed, if any

attempt is to made to divide by zero. (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

10

4 a. Explain with example formatted input output statements in C. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

11

4 b. List four differences between while loop and do-while loop along with syntax

and example. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

12

4 c. Design and develop a C program to reverse a given four digit integer number

and check whether it is a palindrome or not. (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

13

5 a. What is an array? Explain different methods of initialization of single

dimensional arrays. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

14

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

15

5 b. Write a C program to read N integers into an array A and to

i) find the sum of odd numbers

ii) find the sum of even numbers

iii) find the average of all numbers

Output the results computed with appropriate headings. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

16

5 c. How string is declared and initialized? Explain any FOUR string manipulation

functions with examples. (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

17

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

18

6 a. Explain function call, function definition and function prototype with examples

to each. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

19

6 b. What are actual parameters and formal parameters? Illustrate with example.

(06 Marks)

Ans:

6 c. What is recursion? Write a C program to compute the factorial of a given number

‘n’ using recursion. (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

20

7 a. How structure is different from an array? Explain declaration of a structure with

an example. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

21

7 b. Explain with an example, how to create a structure using ‘typedef’. (04 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

22

7 c. Write a C program to input the following details of ‘N’ students using structure:

Roll No: integer, name: string, marks: float, grade: char

Print the names of the students with marks >= 60.0%. (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

23

8 a. Explain following file operations along with syntax and examples:

i)fopen() ii)fclose() iii)fscanf() iv) fprintf() v)fgets(). (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

24

8 b. Write a C program to read the contents from the file called abc: text, count the

number of characters, number of lines and number of white spaces and output the

same. (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

25

8 a. Define pointer variable. Explain with an example, the declaration and

initialization of pointer variable. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

26

8 b. Explain following C functions along with syntax and example to each.

i) malloc() ii) calloc() iii) realloc iv) free() (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

27

8 c. Develop a C program to read two numbers and function to swap these numbers

using pointers. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

28

10 . Write short notes on following:

a. Preprocessor directives

b. Primitive and non primitive data types

c. Stack operations

d. Types of queues. (20 Marks)

Ans:

a)

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

29

Ans:

b)

Ans:

c)

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

30

Ans:

d)

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

1

1 a. What are data types? Mention the different data types supported by C language,

giving an example to each. (5 Marks)

Ans:

1 b. Write a C program which takes as input p, t, r. Compute the simple interest and

display the result. (5 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

2

1 c. What is an operator? List and explain various types of operators. (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

3

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

4

2 a. What is a token? What are the different types of tokens available in C language?

Explain. (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

5

2 b. Write C expressions corresponding to the following (Assume all quantities are of

same type) (06 Marks)

Ans:

2 c. What is the value of ‘x’ in the following code segments? Justify your answers:

(06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

6

3 a. What are the different types of conditional decision making statements? Explain

each with example. (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

7

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

8

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

9

3 b. Write a C program to simulate simple calculator that performs arithmetic

operations using switch statements. Error message should be displayed, if any

attempt is to made to divide by zero. (10 Marks)

Ans:

4 a. Explain with example formatted input output statements in C. (06 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.1b.

4 b. List four differences between while loop and do-while loop along with syntax

and example. (06 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.4b.

4 c. Design and develop a C program to reverse a given four digit integer number

and check whether it is a palindrome or not. (08 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.4c.

5 a. What is an array? Explain different methods of initialization of single

dimensional arrays. (06 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.5a.

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

10

5 b. Write a C program to read N integers into an array A and to

i) find the sum of odd numbers

ii) find the sum of even numbers

iii) find the average of all numbers.

Output the results computed with appropriate headings. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

11

5 c. How string is declared and initialized? Explain any FOUR string manipulation

functions with examples. (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

12

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

13

6 a. Explain function call, function definition and function prototype with examples

to each. (06 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

14

6 b. What are actual parameters and formal parameters? Illustrate each with

example. (06 Marks)

Ans:

6 c. What is recursion? Write a C program to compute the factorial of a given number

‘n’ using recursion. (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

15

7 a. How structure is different from an array? Explain declaration of a structure with

an example. (06 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.7a.

7 b. Explain with an example, how to create a structure using ‘typedef’. (04 Marks)

Ans:

7 c. Write a C program to input the following details of ‘N’ students using structure:

Roll No: integer, Name: string, Marks: float, Grade: char

Print the names of the students with marks >= 60.0%. (10 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.7c.

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

16

8 a. Explain following file operations along with syntax and examples:

i)fopen() ii)fclose() iii)fscanf() iv) fprintf() v)fgets(). (10 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

17

8 b. Write a C program to read the contents from the file called abc: text, count the

number of characters, number of lines and number of white spaces and output the

same. (10 Marks)

Ans:

9 a. Define pointer variable. Explain with an example, the declaration and

initialization of pointer variable. (06 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.9a.

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

18

9 b. Explain following C functions along with syntax and example to each.

i) malloc() ii) calloc() iii) realloc iv) free() (08 Marks)

Ans:

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

19

9 c. Develop a C program to read two numbers and function to swap these numbers

using pointers. (06 Marks)

Ans: For answer, refer Solved Paper June-2015 Q.No.10d.

10 . Write short notes on following:

a. Preprocessor directives

b. Primitive and non primitive data types

c. Stack operations

d. Types of queues. (20 Marks)

Ans: a) For answer, refer Solved Paper June-2015 Q.No.10a.

Ans: b) For answer, refer Solved Paper June-2015 Q.No.9b.

Ans: c)

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

20

Ans: d)

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/