Css 112 Sample Question
Css 112 Sample Question
Css 112 Sample Question
123
456
789
22.Take three arrays [A, B and AB] of float data type of size 5. Scan the values
of two arrays [A and B] from user. Now assign the summation of the two
arrays to the AB. (AB[i] = A[i] + B[i]).
23.You are given the following array of integers-[1, 23, 10, 15, 17, 21, 44, 43,
53].Now write a program which will print the prime numbers with its index.
24.Take two arrays [A and B] of float data type of size 5. Scan the values of
two arrays from user. Now compare the averages of two arrays and print the
largest average with the array name.
26.Write a function that takes two integers as input and prints their sum inside
the function.
27.Write a function that takes an integer as input and prints EVEN if the
number is divisible by 2 otherwise prints ODD. Call this function from the
main function.
28.Write a function that takes an integer as input and prints all of its divisors.
Call this function from the main function.
29.Suppose you are going to make a simple calculator. Your task is to prepare
four functions- add(), subtract(), multiply() and divide() . Each function
takes two parameters and return the value after applying the corresponding
action on those parameters.
30.Write a function named findMax(). It takes three parameters and return the
maximum value among the three parameters. Call this function from the
main function.
33.Take a word from user and print the word in reverse order. [If user gives
“BANGLADESH”, your program should print “HSEDALGNAB”]
34.Write a program which will take a sentence as input and tell us how many
words are there. [If user gives input “I love Bangladesh”, then the output
should be: 3]
35.Let’s take a string and you have to find how many alphabets are there and
their repetitions. Case sensitive.
Ex: Input: Output:
AaaBBc A(1)B(2)a(2)c(1)
36.Take two pointer variables of integer type named pX and pY. Now take
another two variables of integer data type named X and Y. Assign X = 100
and Y = 200. Assign the address of X to pX and address of Y to pY. Now
print the values of X and Y using pX and pY.
int main(){
int a[]={5,10,15,20,25};
int *pA;
pA = &a[2];
return 0;
38.Is there any error in the following program? If not what will be the output-
#include<stdio.h>
int main(){
int i;
double *pA;
double a[]={5,10,15,20,25};
pA = a;
for(i = 0; i < 5; i++){
printf(“%.2lf “,*(pA+i));
return 0;
}
39.Take an integer variable named VAR and assign VAR = 500. Take a pointer
variable named *ptr of integer type and assign the address of VAR to ptr.
Then take another pointer to pointer variable named **pptr of integer type
and assign the address of pointer variable ptr to pptr. Now print the value of
VAR using the VAR , ptr and pptr respectively in three different lines.
{Memory Address of X is : XXXXXX}
40.Take an array of string named fruitNames and store four fruit names
(“Mango”, “Jack-fruit”, “Banana”, “Litchi”). Now iterate the array using
loop and print the names of the fruits each in a separate line.