For Solved Question Papers of UGC-NET…pencilji.com/download/75679253.pdf · PROGRAMMING IN C &...

55

Transcript of For Solved Question Papers of UGC-NET…pencilji.com/download/75679253.pdf · PROGRAMMING IN C &...

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:

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:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

3

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:

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:

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:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

7

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

8

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:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

10

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

Ans:

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:

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:

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:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

14

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:

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:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

17

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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)

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER JUNE- 2015

29

Ans:

b)

Ans:

c)

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/

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

1

1 a. Explain the structure of ‘C’ program with example. (5 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

2

1 b. Explain scanf() and printf() function in ‘C’ language with syntax and examples.

(5 Marks)

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

1 c. Write a ‘C’ program to find area of circle. (5 Marks)

Ans:

2 a. What is an algorithm? Write an algorithm to find largest of 3 numbers. (5 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

3

2 b. Explain the following operators in ‘C’ language.

i) Relational ii) Conditional iii) Logical (5 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

4

2 c. What is an identifier? Give any 5 rules that are to be followed while declaring a

variable. (4 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

5

3 a. Explain the ELSE IF ladder with syntax and example. (8 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

6

3 b. List the types of loops. Explain the working of any one type of loop with syntax

and example. (8 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

7

3 b. Write a program to read a year as an input and find whether it is a LEAP YEAR or

not (8 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

8

4 a. Explain SWITCH statement, with syntax and example. (8 Marks)

Ans:

4 b. Differentiate between WHILE and DO-WHILE loops. (6 Marks)

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

4 c. Write a program to find reverse of a number and check whether it is a

PALINDROME or not (6 Marks)

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

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

9

5 a. What is an ARRAY? Explain the different ways of initializing an array with

examples. (7 Marks)

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

5 b. What are the advantages of using User defined functions. (6 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

10

5 c. Write a program to read a sentence and print the frequencies of each VOWEL

and total count of CONSONANTS. (7 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

11

6 a. Explain the different types of arrays, with syntax and examples. (7 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

12

6 b. Explain any 4 string manipulating functions with examples. (8 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

13

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

14

6 c. Define the following:

i) Actual parameter

ii) Formal parameter

iii) Global variable (external variable)

iv) Local variable (automatic variable) (5 Marks)

Ans:

7 a. Define a STRUCTURE. Explain structure with syntax and example. (5 Marks)

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

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

15

7 b. What is a FILE? Explain any 2 FILE functions, with example. (5 Marks)

Ans:

7 c. Write a program to maintain a record 0f ‘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 students based on the student name as

input (10 Marks)

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

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

16

8 a. Differntiate between STRUCTURES and UNIONS. (5 Marks)

Ans:

8 b. Explain the various MODES in which a FILE can be created successfully. (5

Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

17

8 c. Given 2 university information files ‘student.txt’ and ‘usn.txt’ that contains

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. (10 Marks)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

18

9 a. Define a POINTER. Explain how pointer variable is declared and initialized. (6

Marks)

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

9 b. What are primitive and non-primitive data types? Give examples. (6 Marks)

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

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)

Ans:

PROGRAMMING IN C & DATA STRUCTURES SOLVED PAPER DEC- 2015

19

10 a. Explain any 2 pre-processor directives in ‘C’ language. (5 Marks)

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

10 b. What is a STACK? Explain its applications. (5 Marks)

Ans:

10 c. What is a QUEUE? Explain with example. (5 Marks)

Ans:

10 d. Write a program to swap 2 numbers using call-by-refernce method. (5 Marks)

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