5.
a) Discuss with the help of examples the action of break statement and the continue statement.
b) Does the null statement have any uses besides indication that the body of a loop is empty? Explain.
c) What is the purpose of the \? Escape sequence?
(8+4+3)
6.
a) Is it legal to put a function declaration inside the body of another function? If yes, give an example.
b) Is it legal for a function f1 to call f2, which then calls f1? Justify your answer.
c) Write a ‘C’ function that returns the k-th digit from the right in the positive integer n. For example, digit(829,1) returns 9, digit(829,3) returns 8. If k is greater than the number of digits in n then the function is to return –1. Include appropriate documentation in your program.
a) Is it legal to put a function declaration inside the body of another function? If yes, give an example.
b) Is it legal for a function f1 to call f2, which then calls f1? Justify your answer.
c) Write a ‘C’ function that returns the k-th digit from the right in the positive integer n. For example, digit(829,1) returns 9, digit(829,3) returns 8. If k is greater than the number of digits in n then the function is to return –1. Include appropriate documentation in your program.
(4+2+9)
Bool search(int a[], int n, int x);
Where a is an array to be searched, n is the number of elements in the array, and x is the search key. “search” should return TRUE if x matches some element of a, FALSE if it doesn’t. Use pointer arithmetic to visit array elements. Include appropriate documentation in your program.
7.
a) If a pointer is an address, what does the expression like p + j mean?
b) Is i[a] same as a[i]? Justify your answer.
c) Write the following function:
a) If a pointer is an address, what does the expression like p + j mean?
b) Is i[a] same as a[i]? Justify your answer.
c) Write the following function:
Bool search(int a[], int n, int x);
Where a is an array to be searched, n is the number of elements in the array, and x is the search key. “search” should return TRUE if x matches some element of a, FALSE if it doesn’t. Use pointer arithmetic to visit array elements. Include appropriate documentation in your program.
(4+2+9)
8.
a) Develop an algorithm to do the following:
Read an array of 20 elements and then send all negative elements of the array to the end without altering the original sequence.
b) Draw a flow chart and then write a ‘C’ program to generate first 15 members of the following sequence.
1, 3, 4, 7, 11, 18, 29, ...
(5+10)a) Develop an algorithm to do the following:
Read an array of 20 elements and then send all negative elements of the array to the end without altering the original sequence.
b) Draw a flow chart and then write a ‘C’ program to generate first 15 members of the following sequence.
1, 3, 4, 7, 11, 18, 29, ...
9.
Develop a flowchart and then write a program for analyzing a line of text stored in a file by examining each of the characters and displaying into which of several different categories vowels, constants, digits, white spaces it falls. Count of the number of vowels, consonants, digits and white space characters. Include an appropriate documentation in your program.
(15)Develop a flowchart and then write a program for analyzing a line of text stored in a file by examining each of the characters and displaying into which of several different categories vowels, constants, digits, white spaces it falls. Count of the number of vowels, consonants, digits and white space characters. Include an appropriate documentation in your program.
No comments:
Post a Comment