Important Questions for CIE2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Important Questions

Short Questions
1. Write a user defined function to multiply two numbers.
2. Write a program to demonstrate Recursion
3. Write a user defined function to add two numbers.
4. Write a program to calculate factorial of a number using recursion.
5. What is #include, #define directives.
6. What are the Different ways of representing Structures and
Functions?
7. Define static memory allocation.
8. Define Union? Give its syntax?
9. Define Structure? Give syntax?
10.What are generic pointers?
11.Explain Dangling Pointers?
12.What is pointer to pointer?
13.List the File Opening Modes?
14.Write about different error handling functions on files?
15.List the File Positioning Functions and their purpose?
16.Difference between Union and Structure?

Long Questions
1. Define Functions? Explain function declaration, definition and
function call.
2. Write about Linear search and Binary search with example.
3. Explain Dynamic Memory Allocation. What are the library functions
used for it.
4. Write in detail about storage classes with examples.
5. Differentiate between call by value and call by reference with
suitable example program.
6. Explain the concept of functions returning pointers with example.
7. Explain Bubble sort with example program.
8. Elaborate about pointer arithmetic.
9. Write in detail about Preprocessor directives.
10.Discuss command line arguments in detail with examples.
11.Write a short notes on
12. i.fgets() ii. fputs()
13. Explain any 2 categories of functions?
Quiz Paper
1.What is the default return type of a function in C if not specified?
a) float b) char c) int d) void
2.What does the following code output?
int a = 10, *p;
p = &a;
printf("%d", *p);
Address of a b) 10 c) 0 d) Error

3.Which of the following is the correct way to access a member of a structure using
a pointer?
a) ptr.member b) ptr->member c) *ptr.member d) ptr:member

4.If ptr is a pointer to int, having value ptr=100. After ptr++, what is the value of
ptr?

a) 100 b) 101 c) 102 d) 103

5.A pointer value refers to

a) A float value b) An integer constant c) Any valid address in memory d) None

6.How is a union different from a structure in C?


a) All members of a union share the same memory space.
b) Unions can only store integers.c) Structures are faster than unions.
d) Unions cannot have pointers as members.

7.What is the size of a C structure?

a) C structure is always 128 bytes


b) Size of C structure is the totatl bytes of all elements of structure
c) Size of C structure is the size of largest elements
d) None of the above

8.What does typedef do in C?


a) Allocates memory dynamically.b) Defines a new data type name.
c) Declares a constant value.d) Defines a macro.

9.Which of the following is a correct enum declaration?


a) enum color {RED, GREEN, BLUE};b) enum color(RED, GREEN, BLUE);
c) enum color = {RED, GREEN, BLUE};d) enum(color: RED, GREEN, BLUE);

10.Which function is used to open a file in C?


a) read() b) open() c) fopen() d) start()
11.In C, how are function arguments passed by default?

a) By Value b) By reference c) By pointer d) By address

12.What does the mode "r+" do in fopen()?


a) Opens the file for reading only. b) Opens the file for writing only.
c) Opens the file for both reading and writing. d) Creates a new file if it doesn’t exist.

13.In call by reference, what is passed to the function?


a) The actual value of the variable b) A pointer or reference to the variable
c) A copy of the value d) None of the above

14.What is the purpose of the return statement in a function?

a) To declare the function’s return type b) To exit the program

c)To return a vlue from the function d) To define a function

14.What is the purpose of a function prototype in C

a)To declare a function’s return type b) To declare a function’s name


c) To declare a function’s parameters and retur type
d) Todeclare a function’s name and parameters

15.What is the difference between malloc() and calloc()?


a) malloc() initializes memory to zero, calloc() does not.
b) calloc() initializes memory to zero, malloc() does not.
c) malloc() allocates memory for arrays, calloc() does not.
d) calloc() returns NULL, malloc() does not

You might also like