FinalAssesmentModel 2081 (Student)
FinalAssesmentModel 2081 (Student)
1 a. Differentiate between source code and object code? Write an algorithm and draw the flowchart to
calculate the factorial of a positive integer.
b. What is a good computer program? Write an algorithm that displays the following series up to n
terms:
0,1,1,2,3,5,8,13,21,…………..
c. What is programming language? What are the different types of programming languages?
d. What are the steps that need to be followed for developing the computer program?
2 a. What are the various constants available in C programming? Give examples. Write the output of the
following code:
i) int a=5, b=2; ii) int a=5, b=2;
float r; float r;
r=a/b; r=(float)a/b;
printf("r=%f", r); printf("r=%f", r);
b. Write down the use of isalpha() and isdigit() functions in C? What are the rules for declaring valid
identifiers in C? Explain with some valid and invalid identifiers.
c. What is data type, constant and variable? Define preprocessor directives with example.
3 a. Define relational and logical operators with example. Explain the use of conditional operator in C.
b. Define unary, binary and ternary operator. Explain precedence of an operator with example.
c. Explain relational and logical operators in C with their correct order of precedence.
4 a. What is the purpose of getchar() and gets() function? Why is printf() called formatted output
function? Explain.
b. What are the differences between formatted and unformatted I/O statements? Explain with
examples.
c. What are different unformatted input functions in C? Explain formatted input for strings?
5 a. Differentiate between break and continue statement with suitable example. Write a program to check
whether a given n-digit number is an Armstrong number or not.[Hint: any n digit number is an
Armstrong number if the sum of nth power of its digits is equal to the number itself, e.g.
153=13+53+33=153 or 1634=14+64+34+44 =1643,etc.]
b. Write a program to display all possible roots of a quadratic equation.
c. Differentiate between nested if else statement and else if ladder statement. Write a program to input
the numbers until user enters -1. You have to check whether those numbers are palindrome or not.
Display only those numbers which are palindromes and also display their count.
d. What is control structure? Explain switch statement with syntax and suitable example.
e. Write a program to display first N Prime numbers, where N is read from a user.
f. Write a program to display the chess board pattern. [Hint: Display “\xdb” for white color and blank
for black color]
6 a. Why do we use array in programming? What are its limitation? Write a program to read marks of
48 students in a class and calculate the standard deviation of marks.
b. Write a program to sort the characters of a string in alphabetical order.
c. Explain pointer arithmetic. Write a program to input any 2D array and display in matrix form using
pointer notation.
d. Explain about initialization and memory allocation in 2D array. WAP to input and separate even
numbers and odd numbers into two different arrays and display the results.
e. Write a program in C that exactly simulates the task of the function strrev().
f. What is null and generic pointer? Why are pointers used in C?
g. Define array. Explain how 2D array is passed to function with suitable example.
h. Write a program to reverse any string? Explain relation between array and pointer.
7 a. What are the different elements of user defined function? Explain user defined function having
return type and no arguments with suitable example.
b. Write a recursive function to display the terms of the Fibonacci series from 1 to n.
c. What do you mean by library functions and user defined functions? Differentiate between call by
value and call by reference in function.
d. Write a program to define a function that checks whether any integer is prime or not. Use this
function to display all the prime numbers between 1 to 100.
e. What do you mean by local and global variable? Write a program to read an integer and pass it to
a function that calculates the number of even and odd digits present in it. Display the results from
main function.
f. Write a program using recursion to compute the sum of the following series:
12 – 32 + 52 – 72…………. + (-1)n+1 (2n-1)2
8 a. What do you mean by nested structure? Write a program to demonstrate the use of ‘.’ and ‘→’
operator in structure.
b. What do you mean by array of structure? Write a program to read marks of 48 students using
structure and display the details of only those students who has obtained the highest and lowest
marks.
c. Explain array within structure? Write a program to represent time by a structure with hour, minute
and second as members. Take 2 times as input from user into structure variables. Pass the times to
a function which calculates their sum and returns it.
9 a. Write a program to read integers from user until user says "no". After reading the data write all the
odd numbers to a file named "ODD.txt” and all the even numbers to a file named "EVEN. txt".
Also read the contents from both of the files and display separately. Use arrays to write and read
from the files.
b. Explain random access in file I/O. Write a program to read name, salary, address and employee ID
of the employees until the user says “no”. After reading the data, write it to the file then display the
content from the file.
c. Write a program to read details of student using structure and write it to a file source.txt. Copy the
content of it into another file destination.txt and display the content of destination.txt.
10 a. What are the features of OOP? Explain any one them.
b. What is method in OOP. Differentiate between POP and OOP?
c. What do you mean by Object Oriented Programming? Define class and object in OOP?
***Best Wishes***