July 5, 2021 in C and CPP
What is an algorithm?
c) What is an algorithm? Develop an algorithm to test whether a given number is a prime
number.
July 5, 2021 in C and CPP
c) What is an algorithm? Develop an algorithm to test whether a given number is a prime
number.
July 5, 2021 in C and CPP
b) Enumerate features of a good ‘C’ program. Describe the commonly used techniques as
to how ‘C’ programs can be made highly readable and modifiable.
July 5, 2021 in C and CPP
a) What are logical, syntactic and execution errors? Give examples of each. Which is most
difficult to find and why?
July 5, 2021 in C and CPP
b) Develop a flowchart and then write a program to compute the roots of a quadratic
equation A*X^2 + B*X + C = 0. Allow the possibility that (B^2 – 4*A*C) <= 0.
July 5, 2021 in C and CPP
a) What are the commonly used input functions in ‘C’? Write their syntax and explain the
purpose of each.
July 5, 2021 in C and CPP
A. integer array B. pointers C. program
D. printf( ) and scanf( ) E. character array F. &&
G. function H. Main I. getw( )
J. reference, value K. static L. for
M. extern N. ternary O. register
P. putw( ) Q. main( )
4.1 Formatted I/O can be produced with the routine(s) ________.
4.2 The ________statement is used to loop as long as a specified condition is met.
4.3 To create a string variable, me must declare a(n) ________ with enough elements to
contain the entire string.
4.4 Call by ________ is more efficient than call by file.
4.5 exit( ) function is used to terminate the ________.
4.6 The only operator that contains three operands is ________ operator.
4.7 The declaration ________ does not allocate storage space for variable.
4.8 The function ________ reads an integer from a file.
4.9 All buffers are cleared when a ________ closed.
4.10 Preprocessor directives are placed in the source program before the function ________.
July 5, 2021 in C and CPP
2.1 Scalar data types are not supported by ‘C’ language.
2.2 ‘C’ language allows arrays of any dimensions.
2.3 A structure cannot be read as a single entity.
2.4 The associativity of operator ! is from left to right. .
2.5 J++ executes faster than J+1 because ++ is faster than +.
2.6 Two structures cannot be compared automatically.
2.7 The code "a[i] = i++;" is valid and will execute.
2.8 Arrays automatically allocate space when declared.
2.9 sizeof(‘a’) is not 1.
2.10 Float value can be added to a pointer.
July 5, 2021 in C and CPP
1.10 Size of the following union (assume size of int=2; size of float=4 and size of char = 1):
union Jabb
{
int a;
float b;
char c;
};
A) 2
B) 4
C) 1
D) 7
July 5, 2021 in C and CPP
1.9 Output of the following program will be:
main( )
{
int a [ ] = {1, 2, 9, 8, 6, 3, 5, 7, 8, 9};
int *p = a+1;
int *q = a+6;
printf (“\n%d”, q-p);
}
A) 9
B) 5
C) 2
D) None of the above
July 5, 2021 in C and CPP
1.8 The CONTINUE statement cannot be used with
A) for
B) switch
C) do
D) while