B.Sc. CSIT 1st Semester Old Questions
Subject : C – Programming
- Subject : C – Programming
- C-Programming Year: 2065 Old Question
- Bsc. CSIT C- Programming Old Question of Year: 2066
- Old Question of C-programming Bsc. Csit Year: 2067
- Year: 2068 Old Question of BSc. CSIT
- Year: 2069 Old Question of C-programming
- Year: 2070 Old Question Bsc. CSIT
- Year: 2071 Old Question C-Programming Bsc. CSIT First Semester
- Year: 2072 Question of C-Programming
- Year: 2073 C-Programing Old Question Bsc. CSIT
C-Programming Year: 2065 Old Question
Attempt all questions:
- Draw the flow chart for finding largest of three numbers and write an algorithm and
explain it. - Find the value of “a” in each of the following statements:
int i=3 , j=4 ,k=8
float a=4.5 ,b=6.5,c=3.5
(a) a = b- i/k +c/k
(b) a = (b-k)/j + (j + c)/k
(c) a = c-(( i + j)/(k + i))*b
(d) a = c – i + j / k+ i * b
(e) a = c + j % 2 +b
(f) a = (b + 1) % (c + 1). - Write a program for the interest charged in installments for following case. A cassette
player costs Rs. 2000. A shopkeeper sells it for Rs. 100 down payment and Rs. 100
for 21 more months. What is the monthly interest charged? - Write a program that uses a “for” loop to compute and prints the sum of a given
numbers of squares. - Write a program to obtain the product of the following matrices and explain it:
A = [
3 5 7
2 −3 4
4 5 2
] , B = [
7 6
6 −5
4 3
]
- Write a function to add, subtract, multiply, and divide two complex numbers (x +iy)
and (c + id). - Write a program which will read a line and delete from it all occurrences of the word
“that”. - What is a pointer and explain its applications? Write a program that uses pointers to
copy an array of double.
OR
Define a pointer. Write a function that is passed an array of n pointers to the
maximum of the floats.
- Define a structure of employee having data members name, address, age, and salary.
Take data for employee in an array dynamically and find the average salary. - Given a text file, create another text file deleting the following words “three”, “bad”,
and “time”.
OR
Why do you require a graphical function? Explain the basic graphical function with
suitable program.
Bsc. CSIT C- Programming Old Question of Year: 2066
Attempt all questions:
- Why flow chart is required? Explain different symbols used in the flow chart and explain
with suitable example. - Determine which of the following are valid identifiers? If invalid, explain why?
(a) record1 (b)record
(c) file_3 (d) return
(e) #tax (f) name
(g) goto (h) name and address
(i) name-and-address (j) 123-45-6789
(k) Void (l) name_address
- Find the error in the given program and explain it. Write the correct program.
include<stdio.h>
include<math.h>
main
{
float p, r, n;
printf(“Please enter a value for the principle (P):”);
scanf(“%f”, &p);
printf(“Please enter a value for the interest rate (R)”);
scanf(“%f”, &r);
printf(“Please enter a value for the number of years (n):”):
scanf(“%f”, n);
f = p * pow + r/100),n);
printf(\n The final value (F) is: %. 2f\n”, f);
- Write a program that uses a “while” loop to compute and prints the sum of a given
numbers of squares. For example, if 4 is input, then the program will print 30, which is
equal to 1
2 + 2
2 + 3
2 + 4
2
. - Write a program to enter two 3×3 matrices and calculate the product of given matrices.
- Explain the use of two dimensional arrays. Illustrate it with suitable program and
explain it. - Write and test the following power () function that returns x raised to the power n,
where n can be any integer:
double power (double x, int p)
- Justify the pointer is jewel of C language. Write a function that is passed an array of
pointers to floats and returns a newly created array that contains those n float values in
reverse order. Assume any necessary data.
OR
Explain pointer with suitable diagram. Write a function that uses pointers to search for
the address of a given integer in a given array. If the given integer is found, the function
returns its address; otherwise it returns NULL.
- Why structure is required? Make a program using structure of booklist having data
member’s title, author, and cost. Enter four data and calculate total cost. - Create a text file and enter “to write a good program is very time consuming job”. Create
another text which contains reverse of above text.
OR
Explain the use of graphical function. Make a program that contains basic graphic
functions.
Old Question of C-programming Bsc. Csit Year: 2067
Attempt all questions:
- Draw the flowchart for the solution of a quadratic equation and write an algorithm
and explain it - Find the value of “a” in each of the following statements:
int i = 2, j = 5, k = 7;
float a = 1.5, b = 2.5, c = 3.5;
(a) a = c – i/j + c/k ;
(b) a = (c – i)/k+( j+ b)/j ;
(c) a = b * b – (( i + j )/c);
(d) a = b – k + j/k +i *c;
(e) a = c + k % 2 +b;
(f) a = ( b+ 4) % ( c + 2); - A machine is purchased which will produce earning of Rs. 20000 per year while it
lasts. The machine costs Rs. 120000 and will have a salvage value of Rs. 20000 when
it is condemned. If the 12 percent per annum can be earned on alternative
investments what should be the minimum life of the machine to make it a more
attractive investment compared to alternative investments? - Write a program to transpose the following matrix
|
−3 7 5 −2 8
2 5 8 3 −4
−6 9 3 6 5
|. - Write a program that uses a do…while loop to compute and prints the sum of squares
given n numbers. - Write a function to multiply two n x n matrices.
- Write a program to count the number of words in a sentence.
- Why pointer is called jewel of C language? Write a program that uses pointers to copy
an array of integer.
OR
Explain the importance of pointer. Write a function that is passed an array of
pointers to floats and returns a newly created array that contains those float values - Define a structure of student having data members, name, address, marks in C
language, and marks in information system. Take data for students in an array
dynamically and find the total marks obtained. - Some text file is given; create another text file replacing the following words “Ram” to
“Hari”,“Sita” to “Gita”, and “Govinda” to “Shiva”.
OR
What are the uses of graphical function? Explain the basic graphical function with
suitable program.
Year: 2068 Old Question of BSc. CSIT
Attempt all questions:
- Write an algorithm and flow chart to determine whether a given integer is odd or even
and explain it. - How can you declare the variable in C? Explain with example.
- Write a program to find the factorial of a given integer.
- Explain switch statement with example.
- Write a program to find the largest and smallest among the given elements in an array.
- Explain the user-defined functions and its types with example.
- Write a program to accept two numbers and sort them with using pointer.
- Explain the passing structure to function with example.
- Write a program to accept any number and print the sum of that number up to a single
digit through recursive function.
10.Explain the pointer to structure with example.
OR
Write short notes on :
a) Dynamic memory allocation
b) Opening and Closing file
Year: 2069 Old Question of C-programming
Attempt all questions:
- Write an algorithm and flowchart to find out whether a given integer is zero, +ve or
–ve and explain it. - What are the basic four data types used in C programming? What are its size and
range? Explain. - Explain the “if…….else” statement with example.
- Differentiate between break and exit statement with example.
- Explain the multidimensional array with example. Write a program to convert a
lowercase character string into uppercase. - Explain the library functions with example.
- Write a program to find the sum of all the elements of an array using pointers.
- Explain the pointer arithmetic with example.
- Explain the array of structures and write a program to accept record of 15 person which
has name, age and address and also display them.
10.What are the three types of input/output functions which support in C-
programming? Explain with example.
OR
Write short notes on:
a. Delimiters
b. Graphics function
Year: 2070 Old Question Bsc. CSIT
Attempt all questions:
- What is logical error? Write flowchart and program for checking whether the number
entered by the user is exactly divisible by 5 or by 11. [1+5]
OR
What is algorithm? Write an algorithm to check given number is prime or composite.
[1+5] - What is operator? List any six operators used in C-programming language. Write a
program to find least number between any two numbers using ternary operator.
[1+2+3] - Define printf() function, header file and main function. Find the value of following
expression. Use the value initially assigned to the variables for each expressions.
[4.5+1.5]
int a = 8, b = 5;
float x = 0.005, y = -0.01;
1) 2 * ((a / 5) + 4 * (b – 3)) % (a + b – 2));
2) (x > y) && (a > 0) || (b < 5); 3) (a > b)?a:b; - Difference between if and switch statement. Write a program to read the marks of four
subjects then find total, percentage and division according to given condition. [1+5]
Percentage Division
p ≥ 80 Distinction
80 > p ≥ 70 First division
70 > p ≥ 50 Second division
50 > p ≥ 40 Third division
Otherwise Fail
Assume each subjects carrying 100 full marks and students must secure greater or
equal to 40 in each subjects for division. - Differentiate between break and continue statement. Write a program to display
following output [2+4]
1
1 1
1 1 1
1 1 1 1
1 1 1 1 1
- Write a program to input any 10 numbers then find out greatest and smallest number.
[6] - Write a program to add two 3×3 matrix using function. [6]
- What is recursion? Write a program to find the factorial of given number using
recursion. [2+4]
OR
What is pointer? Write a program to sort ‘n’ numbers in ascending order using dynamic
memory. [2+4] - List any five names of graphics function. Write a program to read line of text then count
no. of vowels, No. of digits and no. of spaces. [2+4] - Write a program to create a file “RECORD.TXT” then store roll no, name and
percentage of 10 students. [6]
Year: 2071 Old Question C-Programming Bsc. CSIT First Semester
Attempt all questions:
- Explain the structure of C-Program with example.
- What do you mean by statements? Explain the different types of statement with
example. - Explain the relational operator and Increment/decrement operator with example.
- What are the four types of control statement use in C programming? Explain.
- Explain the functions and its types use in C programming with example.
- Write a program to accept 10 numbers and print the sum of these numbers through
function. - Explain the use of pointer in C-programming. How can you declare the pointer?
Explain with example. - Write a program to accept 10 numbers and soft them with using pointer.
- Write a program to read the data file which has following details.
a. Name
b. Age
c. Test player
d. Total run.
10.Explain the passing structure to function with example.
OR
Write short notes on:
a. Graphics function
b. Formatted I/O
Year: 2072 Question of C-Programming
Attempt all questions
- Draw a flow chart and write an algorithm to find a number is divisible by either 5 or
7? (6) - Discuss logical operators along with the truth table. Write a program using switch
statement to display EXCELLENT, VERY GOOD, GOOD, SATISFACTORY, or FAIL if
the user enters A, B, C,D,E respectively. (3+3) - What do you mean by entry-controlled and exit-controlled loop? Write a program to
print the following output.(2+4)
1
01
101
0101
10101 - Differentiate break statement with continue statement. What is the output if the
following program ?(2+4)
Include<stdio.h>
include<math.h>
Void main()
{
int x=2, n=5, sum=0, i;
clrscr();
for(i=1; i<=n; i++)
{
If(i%2==0)
Sum==sum-pow(x,i);
else
sum=sum+pow(x,1);
}
Printf(“sum=%d”,sum);
Getch();
}
- Explain pass by value and pass by reference with suitable example of each. (6)
- What is array? Write a program to find the sum of each row of 3*2 matrix.
- What is dynamic memory allocation? Write a program to find sum and average of n
numbers entered from the keyboard using dynamic memory allocation to create array
to store these n numbers.(2+4) - Discuss different file openings modes. Write a program to read all the numbers from
the input file “value.dat” and store only even numbers in an output file named as
“result.res”.(2+4) - Discuss with example any five graphics function used in c-programming. (6)
- Write short notes on:
a) Documentation
b) structure
Year: 2073 C-Programing Old Question Bsc. CSIT
Attempt all questions: (6× 10=60)
- Draw a flow chart and write an algorithm to find out whether a given number is zero,
+ve or –ve. - What are the different types of operators available in C? Explain.
- Describe the four basic data types with example.
- Differentiate between while and do while loop with example.
- Write a program to check whether the diagonal elements of a (4*4) matrix are all Zero.
- What is the function of a pointer variable? Explain the declaring and initializing
pointers with example. - Write a program using pointers to read in an array of integers and print its elements in
reverse order. - Differentiate between call by value and call by reference with example.
- What is structure? How is it different from array and Union? Discuss
10.Define the graphics function. Write a program to draw a circle using graphics function.