## Tuesday, 25 March 2014

### C-Programming and Data Structures Important Questions

C-Programming and Data Structures
Important Questions

UNIT 1

1. Explain and specify the interactions between various components that support the basic functionality of a computer.

2. Draw the flow chart to check whether a given number is perfect or not. And for finding roots of quadratic equations with all cases?

3. Describe the various categories of computing environments.

4. What is an algorithm and Flow chart? Write an algorithm to find out if a given number is a prime.

5. Draw a flowchart to read ten positive integers and print how many are multiples of 7.

6. What is an algorithm? Write an algorithm to read five integers and find out if the values are in ascending order.

7. Draw a flowchart to read ten integers values and print the sum of squares of the values.

8. What are various conditional and relational operators in “C”, explain them with an example.

9. What is meant by compilation? What are the C keywords and elaborate them?

UNIT 2

1. What is type conversion? Explain briefly about implicit and explicit type conversions.

2. An integer is divisible by 9 if the sum of its digit is also divisible by 9. Write a C program that prompts the user to input an integer. The program should then output the number and a message starting whether the number is divisible by 9.

3. Explain the control statements in C language with an example.

4. What is type conversion? Explain briefly about implicit and explicit type conversions.

5. Write a minimal C expressions for the following:

i) 3x4+x3-4x2+7x
ii) Maximum of the values of three variables a, b and c.
iii) Digit at the 100’s place of the given positive integer x (for example, digit at the 100’s place in 3458 is 4).
iv) True if the given positive integer x is even, false otherwise
v) Increment x, and then add to z
vi) True if the given positive integer x is a multiple of 3 and 7, false otherwise.

6. What are the bitwise operators in C? Explain the same with examples.

7. Write a minimal C expressions for the following:

i) 2x4+3x3-4x2+7x-10
ii) Digit at the 10’s place of the given positive integer x (for example, digit at the 10’s place in 3458 is 5).
iii) True if the given positive integer x is even, false otherwise
iv) Add x to y, and then decrement x
v) True if 5<=a<=10,false otherwise
vi) Fourth bit from the right if the number x is treated in binary representation.
8. Write a complete C program to print all the prime numbers between 1 and n, where ‘n’ is the value supplied by the user.

9. Explain all types of operations in C?

Unit 3

1. Define an array. What are different types of array? Explain with examples.

2. Define recursion. Write a c-program to find the factorial of a number using recursion.

3. What is a storage class? Explain various storage classes in C with examples.

4. Explain the differences between call-by-value and call-by-reference with suitable examples.

5.What is recursion? Write a complete c program that reads a positive integer, calculate the factorial of the number using recursion and print the result.

6. Explain the facilities provided by the C preprocessor with examples.

7. Explain the following storage classes with examples :auto,register,extern.

8. Explain how 2-D arrays can be used to represents matrices. Write C code to perform matrix addition and matrix multiplication.

9.Write short notes on scope and lifetime of variables?

Unit 4

1. Explain how strings are declared and initialized in C?

2. What are the arithmetic operators that are permitted on pointers?

3.Write a C program to reverse the string passed as an argument that cannot be altered.

4. Write a complete c-program that reads a string and prints if it is a palindrome or not.

5. Explain about memory allocation functions in C.

6.Explain about string manipulation functions with an example?

7.What is a pointer? Define pointer –pointer concept with an example?

8.Write a c-program to display all the elements of an array using pointer?

Unit 5

1. Explain the following with examples:

a) Pointers to Structures b) Self referential structures c) Unions.

2. Explain the following with examples:

a) Nested structures b) Array of structures c) Unions.

3. What is a Self referential structure ? How it differs from nested structures. Explain with illustrative examples.

4. Write a short note on typedef and enum.

5. What is structure? Give its advantage? Give an example of creating and accessing members of a structure?

6.Write a program using structures to display following

Unit 6

1.What are the ways to set the file pointer randomly in a file ? Explain.

2. Write a C program to copy the content of one file to another file.

3.Write C-language program that reads a c program file and outputs number of lines in the program.

4. List and explain the streams functions for binary files along with their prototypes.

5. List and explain the streams functions for text files along with their prototypes.

6. Write a C program to copy the content of one file to another file.

7. Explain the different modes that can be provided a s a parameter to the fopen( )function.

8. Write a C program for the following: There are two input files named “first.dat”and “second.dat”. The files are to be merged. That is copy the content of “first.dat” and then the content of “second.dat” to a new file named “result.dat”.

9. Describe various types of files with a n example for each?

10. Elaborate file handling functions in C ?

Unit 7

1. Write a `C` program for binary and linear search using recursion to find a given integer in an array of n elements.

2. Illustrate the results for each pass of selection sort, for the following array of elements 2,3,78,5,46,32,56,8,100,9.

3. Explain the Quick sort algorithm with the help of an example.

4. Write a C program or algorithm to sort an array of integers in ascending order using insertion sort.

5. Illustrate the results for each pass of insertion sort, for the following initial array of elements: 68 57 99 33 122 200

6. Explain bubble sort with the algorithm or a C program.

7. Illustrate the results for each pass of bubble sort, for the following initial array of elements: 68 67 99 33 122 200

8. Explain the Merge sort algorithm with the help of an example.

9.Explain all the sorting techniques with an algorithm?

Unit 8

1. Explain the procedure for converting infix expression to postfix expression with an example routine.

i) Stack ii)Queue

3. Write a C-program to demonstrate the operations of a queue using arrays.

4. Explain the procedure for evaluating postfix expression?

5. Explain what is stack and the operations performed on stack.

6. Explain how a stack be implemented using arrays.

7. What is a singly linked list? Explain with C code how the insertion, deletion and searching operations are performed on a singly linked list.

8.Write a C program to implement Queue operations using arrays?