O Level Exam Paper Solved Programming and Problem Solving through C Language

O Level Exam Paper Solved Programming and Problem Solving through C Language

Programming and Problem Solving through C Language
Max. Marks 100 JULY 2019

PART ONE (Answer all Questions)

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the OMR answer sheet supplied with the question paper, following instructions therein.(1×10)

1.1 Which of the following is a keyword used for a storage class?
A. Printf
B. External
C. Auto
D. scanf.

1.2 Which pair of functions below are used for single character I/O?
A. getchar () and putchar()
B. scanf () and print()
C. input () and printf()
D. None of these

1.3 What is the output of below program?
void main(){
char *p=”Hello world”;
int *q;
p++;
printf(“\n%s\n%s”,p,q); }
A. ello world
Ello world
B. Compiler error
C. lo world
lo world
D. ello world
world

O Level Exam Paper of IT Tools & BUSINESS SYSTEMS

1.4 Which of the following is a Scalar Data type?
A. Float
B. Union
C. Array
D. Linked list

1.5 Header files in C contain:
A. Complier commands
B. Library functions
C. Header information of C programs
D. Operator for files

1.6 What is the binary number equivalent of the decimal number 12?
A. 1100
B. 1010
C. 1001
D. 1110

1.7 Pointers are of :
A. integer data type
B. character data type
C. unsigned integer data types
D. none of these

1.8 In C, if you pass an array as an argument to a function, what actually passed ?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array

1.9 Which of the following fopen () statements is illegal in C?
A. fp=fopen(“abc.txt”, “r”);
B. fp=fopen(“c:/user1/abc.txt”, “w”);
C. fp=fopen(“abc”, “w”);
D. none of the mentioned

1.10 Which one of the following is not a keyword in C language
A. Main
B. endl
C. float
D. switch

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and enter in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1×10)

2.1 Array int a[5] can be used to store five character a, b, c, d and e into it. [FALSE]

2.2 C language was initially designed and developed at Microsoft Corporation of USA. [FALSE]

2.3 A semicolon must be placed after closing the conditional expression in a dowhile construct. [TRUE]

2.4 Ternary expression is a selective control construct. [TRUE]

2.5 All the functions, except main() function do not execute on their own, they require a calling function. [TRUE]

2.6 Recursive call is not allowed for main() function. [FALSE]

2.7 A structure cannot contain the structure itself as its member. [FALSE]

2.8 Pointers to pointers is a term used to describe pointer whose contents are the address of another pointer. [TRUE]

2.9 In C, there is a function name strcat () used to concatenate two strings. [TRUE]

2.10 Values of predefined macros can be printed using printf statements in C program. [TRUE]

3 Match words and phrase in column X with the closest related meaning/ word(s)/ phrase(s) in column Y. Enter your selection in the “OMR” answer sheet supplied with the question paper, following instructions therein.

3.1 Keyword used to transfer control form a function back to the calling functionA fseek()
3.2 Statement used to go to the next iteration in a loopB malloc()
3.3 Library function used to clear the specified bufferC switch-case control
3.4 Relational operators cannot be used onD loops control
3.5 Function that allocate and clear allocated memoryE argument
3.6 If you have to use many if –else conditions, they can be usually implemented byF fflush()
3.7 A price of information passed to a methodG for(;;)
3.8 Function that all allocates memory but does not clear allocated memoryH return
3.9 Function used for file pointer movementI continue
3.10 Unending loop if no break statement inside the bodyJ break
K main()
L structure
M calloc

4 Each space below has a blank space to fit one of the word(s)/phrase(s) in the list below. Choose the most appropriate one and enter in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1×10)

A TernaryB size ofC null
D voidE semicolonF #
G incrementH externI static
J structureK pointer to pointerL reference
M getch()

4.1 C language is well suited for_________ [J] programming.

4.2 An [H]_________ storage class can be used to declare global variable known to all the functions in the file.

4.3 [M]_________ function can be used to read a single character.

4.4 The operator “++” is known as [G]_________ operator .

4.5 The_[F]________ operator can be used to allocate memory space dynamically to variables during execution of a program.

4.6 A [K]_________ variable points to another pointer.

4.7 A function with no return type is declare as __________[D].

4.8 A function prototype is always terminated by ___________[E] sign.

4.9 When a structure is passed to a function, then it should pass by___________[L].

4.10 The conditional operator (?:) is a [A]_________ operator.

PART TWO (Answer any four questions)

5. a) What do you mean by pre-processor directives? List and explain its different categories.
b) List out the advantage of functions in C. Also write a function to find second largest number form 1D array of n number.
c) What is the recursive function ? List out their merits and demerits. Also write a C program to calculate factorial of a number using recursion.

6. a) Write a C Program using function to print equivalent binary number of decimal number input by keyboard.
b) What do you mean by algorithm? Also write the algorithm to find multiplication of two matrices.
c) Differentiate between the following: (i) Function definition and function declaration. (ii) Actual parameter and formal parameter.

7. a) Write a C Program to print and count all numbers between 1 to 100 divisible by 11.
b) What is difference between pass by value and pass by reference with example?
c) Write a C program to swap values of two variables without using temporary variable?

8. a) Write a C language program to copy the contents of one file to another file.
b) What is command line argument? Give example through ‘C’ program.
c) What do you understand by ‘pointer to function’? Explain it using an example.

9. a) What do you mean by linked list? Write a function in C to delete a node at particular position from linked list.
b) Differentiate between do –while loop and while loop with the help of one example for each