July 6, 2021 in C and CPP
What are the advantages and disadvantages of using linked list over array?
b) What are the advantages and disadvantages of using linked list over array?
July 6, 2021 in C and CPP
b) What are the advantages and disadvantages of using linked list over array?
July 6, 2021 in C and CPP
a) Input two different arrays of integer. Write a ‘C’ program using pointer variables to
merge them into third array of sufficient size.
July 6, 2021 in C and CPP
c) Write a ‘C’ program to calculate the electricity bill using if..elseif, as per the following
details
* Given the number of units consumed, unit charges are as follows:
i) For first 50 units Rs. 0.50/unit
ii) For next 100 units Rs. 0.75/unit
iii) For next 100 units Rs. 1.20/unit
iv) For unit above 250 Rs. 1.50/unit
* Add fuel surcharge 20% and Govt. Tax 10% on bill to calculate the total bill.
July 6, 2021 in C and CPP
b) Write an interactive C program to evaluate the series: 1 – 1/2 + 1/3 – 1/4 …±1/n, where
n is entered from keyboard.
July 6, 2021 in C and CPP
a) Write a ‘C’ program to find the minimum of the 8 floating point numbers and its place in
the array.
July 6, 2021 in C and CPP
a) What is an array? Show different methods to declare and initialize one dimensional
array. Draw how an integer array of 6 elements having base address 5001 is stored in
memory. Explain actual storage of two dimensional array a[3][4] in the memory with
diagram.
b) Write an algorithm to test whether a given number is prime or not.
July 6, 2021 in C and CPP
c) What is pointer? How is it initialized? What is indirection operator?
July 6, 2021 in C and CPP
b) Write the output of the following and explain it.
struct { int si;
long int li;
char *cp; } s, *ss;
void main() {
printf(“%d, %d, %d, %d”,sizeof(s.li), sizeof(s.cp), sizeof(s), sizeof(ss)); }
July 6, 2021 in C and CPP
a) Write a menu driven ‘C’ program, which prints the options 1, 2, 3 (as given below) and
asks the user to select an option. If user opts
1 then find the factors of the entered number.
2 then check whether the entered number is prime number or not.
3 then directly exit from the program.
The menu should be displayed by a function.
July 6, 2021 in C and CPP
c) Define a structure Time having integer data members hour, minute, second. Write a
program to enter two variables of the type Time and then add these two variables and
store the result into third variable. Also validate the second and minute of the result
and print it.