July 17, 2021 in C and CPP
Maximum number of nodes in a binary tree of depth K
1.1 Maximum number of nodes in a binary tree of depth K
A) 2^K-1
B) 2^K
C) 2^K -1
D) 2^K +1
July 17, 2021 in C and CPP
1.1 Maximum number of nodes in a binary tree of depth K
A) 2^K-1
B) 2^K
C) 2^K -1
D) 2^K +1
July 17, 2021 in C and CPP
b) Write a program which asks for a integer from the user. It reverses the integer and prints “same” if after reversal the number is same as old number otherwise it prints “not same”.
July 17, 2021 in C and CPP
a) Write a program which asks the user to enter the name and age of persons in his group.
The number of persons is not known to the user in the beginning of the program. The user
keeps on entering the data till the user enters the age as zero. The program finally prints the
average age.
July 17, 2021 in C and CPP
c) Write a program in ‘C’ which asks a user to input integers in an array of size 20. It then arranges the elements in decreasing order and prints the array.
July 17, 2021 in C and CPP
b) Write a program which asks the user a number between 1 and 7 and prints the
corresponding day of the week. (1: Sunday, 2: Monday, …)
July 17, 2021 in C and CPP
a) Write a c program to find out factorial of given number using function recursion.
July 17, 2021 in C and CPP
a) What is the output of the following program?
#include<stdio.h>
void fun(int*, int*);
int main()
{
int i=5, j=2;
fun(&i, &j);
printf("%d, %d", i, j);
return 0;
}
void fun(int *i, int *j)
{
*i = *i**i;
*j = *j**j;
}
b) Write and explain the action of WHILE statement. Develop a program in ‘C’ language to
compute the average of every third integer number lying between 1 and 100. Include
appropriate documentation.
c) Write a function which receives two integer arrays and creates a third array by multiplying
corresponding elements (elements with same index) and returns it to main program.
July 17, 2021 in C and CPP
a) What is difference between pass by value and pass by reference?
b) Write a C program which calls a function to swap values of two variables.
July 17, 2021 in C and CPP
c) Write a function which accepts an integer array of size n and prints every third value of the array.
July 17, 2021 in C and CPP
b) Write a function that takes time in seconds as input and prints it in terms of hours, minutes and seconds.