Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which is the correct name of a variable in C language A. 3L C. size-length B.

ID: 3875569 • Letter: 1

Question

1. Which is the correct name of a variable in C language A. 3L C. size-length B. size.length D. length3 2. An array a is initialized as: int all - 10.9.8,7,6 What is value of element a/4)? A. 6 To use built-in function sin(x). which of the library should be included? A. cstdlib B. 7 C. 8 D. 9 3. B. cstdio D ctime -b+vb-4ac 2a C. cmath 4. Which is the equivalent C statement of math formaular x = ? D. x=(-b-sqrt(b*b-4*a"c)),20: 5. The symbol used to mark the beginning of comments is? A. What is the correct statements for open file data.txt for reading C. 6. ifstream input ifstream input 7. How the constants are declared? ofstream input; A. irput.open ("data.txtB. input.open("data.tx) C. input. fopen("data.txt" ifstream input; D. input.close( data.txt") A. const kexyword C. both const keyword and tdefine preprocessor Which looping process is best used when the number of iterations is known? A. Cdowhile B. "define preprocessor D. none of the mentioned s. B. while D. all looping processes require that the iterations be known Page 1

Explanation / Answer

Hi Student ,

Please find the answers below :

1. D ( length3 ) is the correct option. All other options will give you a compile time error.

2. A is the correct option. An array index always starts from 0. So, A[0]=10,A[1]=9 and so on A[4]=6.

3. C is the correct option. cmath is the library which contains the implementation of function sin(x)

4. B is the correct option here. sqrt() function calculates the square root and b*b is for b2

5. A is the correct option. There are two ways to mark comments ->>> a) /* some comments */ b) // some comments in c language.

6. Option A is the correct answer here.

7. C Constants are also like normal variables. But, only difference is, their values can not be modified by the program once they are defined. There can be two ways to define a constant. one is using const keyword and other us usinf a macro ( #define preprocessor) So correct option is C here.

#define PI 3.142 // an example for option B

int const i=10; // an example for A

8. We use a for loop when the number of iterations is know.

for ( i = 0; i<n ; i++) // here we should know the value of n before executing this loop. And while the number of iterations are now known, we use while / do-while loops.

Happy Learning . If this answer enhances your knowledge dont forget to give a thumbs up! as well as your valuable feedback :)