July 5, 2021 in C and CPP
The break statement causes an exit
1.2 The break statement causes an exit
A) only from innermost loop
B) only from innermost switch
C) from the innermost loop or switch
D) none of the above
July 5, 2021 in C and CPP
1.2 The break statement causes an exit
A) only from innermost loop
B) only from innermost switch
C) from the innermost loop or switch
D) none of the above
July 5, 2021 in C and CPP
1.1 The && and || operators
A) compare two numeric values
B) combine two numeric values
C) compare two Boolean values
D) combine two Boolean values
July 5, 2021 in C and CPP
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.
July 5, 2021 in C and CPP
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, …
July 5, 2021 in C and CPP
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.
July 5, 2021 in C and CPP
b) Is i[a] same as a[i]? Justify your answer.
July 5, 2021 in C and CPP
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.
July 5, 2021 in C and CPP
a) If a pointer is an address, what does the expression like p + j mean?
July 5, 2021 in C and CPP
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.
July 5, 2021 in C and CPP, Learning
b) Is it legal for a function f1 to call f2, which then calls f1? Justify your answer.