Define a structure of type hms containing three integer members, called hour, minute and second, respectively. Then define a union containing two members, each a structure of type hms. Call the union members local and home, respectively. Declare a pointer variable called time that points to this union.
See Answer →Write the inorder, preorder and postorder traversals of the following binary search tree.
zWrite a C program which reads a line of text from keyboard, and writes the line to a file with lower case letters converted to upper case and vice-versa.
See Answer →Explain, with an example, the use of the keywords break and continue.
See Answer →Given an integer n, what does the following function compute?
int function(int n)
{
int i;
for(i = 0; n != 0; n %=10, i++)
return i;
}
See Answer →What do you understand by a nested structure? Explain with an example. Also, explain how would you access the members of a structure or a nested structure using pointers?
See Answer →You might recall that the Euler number e can be represented by the following series:
Write a program that approximates e with desired number of terms as entered by the user.
See Answer →Explain how will you allocate memory dynamically for a two dimensional array of floating point numbers.
See Answer →How would you differentiate between the terms pointer to an array and array of pointers? Give proper examples.
See Answer →Explain, with an example, the difference between passing by value and passing by reference.
See Answer →Write a C program to check whether a given string is a palindrome or not.
See Answer →Explain the use of the string library functions strncpy() and strncat(), with the help of an example for each.
See Answer →Suppose you wish to solve the equation x5 + 3x2 − 10 = 0 for x. Rearrange this equation to get an appropriate fixed point iteration method. Then write a program to get an approximate value of the root of the equation. The initial guess must be entered by the user. Your programme must be able to flag a warning message if the initial guess is too far from the exact root. In that case, your program must be able to suggest an initial guess to the user. Terminate the program and print the current value of the root as soon as the difference between two successive approximations becomes smaller than 0.005.
See Answer →Explain the arguments of the functions scanf() and printf(), and how they work with an example for each.
See Answer →Write a loop that examines each character in a character type array called text, and determines how many of the characters are letters, how many are digits, how many are whitespace characters, and how many are other characters.
See Answer →Parenthesise the following C statement for its proper evaluation.
x + = a%b + c ∗ d/e ! = f + + − g
Further, if all the variables from a to g are initialised by 2, then what will be the value of x?
See Answer →Write a C program that takes a list of floating point numbers as input from the keyboard, and prints their mean and standard deviation.
See Answer →Write the output of the following C codes, with proper justification for each.
i) main()
{
int x = 2, y = 2, z = 2;
x = y == z;
y = z == x;
z = x == y;
printf("%d", z);
} ii) main()
{
int x = -1, y;
x++;
y = x ? 2+x : 3-x;
printf("%d", y);
}
iii) main()
{ int i, j, a = 0;
for(i = 1, j = 1; i <= 5; j++)
{
a = a + i*j++; i = j;
}
printf("%d ", a);
}
iv) main()
{
int x = 5, y = 12;
int *p = &x, *q = &y, *r;
r = p;
p = q;
q = r;
printf("%d, %d", x, y);
}
v) func(int x)
{
static int a = 0;
a += x;
return(a);
}
main()
{ int p;
for(p = 1; p <= 5; ++p)
printf("%d", fun(p));
}
See Answer →Disposal of waste materials
See Answer →Disposal of laboratory animals
See Answer →