InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What do you mean by subscript? |
|
Answer» To gain access to a single element within the array, a subscript is used. A subscript may be a numeric constant or an integer-valued variable, is enclosed in parentheses which identify the position of a given element in the array. For example, the first element of array TEST (containing the value 15) is referred to as TEST(0J. The second test score is as TEST[1], the third test score is as TEST[2], and so on. Therefore, the following statements are true: TEST[0] = 15 Subscripts are numbers that come after a symbol and below. For your reference: A3, B3 etc. |
|
| 2. |
(a) Explain the following with reference to ‘C’ language:(i) Data Type(ii) Variables.(b) What are the various arithmetic operators available in ‘C’ language? Explain with example. |
|
Answer» (a) (i) Data Type: A data type decides the amount of memory to be allocated to a variable to store a particular type of data. To allocate memory for a particular piece of data, we have to declare a variable of a particular data type. The variable declaration means that some memory is allocated and that portion of memory will be referred to by the variable name.
(ii) Variables: A variable is a name that represents a number or a string. Each numeric variable must consist of a letter or a letter followed by an integer. All variables that are to be used in the program must be declared prior to its use. Declaring a variable means defining a name and a data type of a variable. Every variable declaration is terminated by a semicolon. Variable names must begin with an alphabet. The first character may be followed by a sequence of letters or digits and can also include the special character ‘Underscore’. (b) Arithmetical Operators: Operators that perform mathematical operations are called Arithmetical operators. These operators form a mathematical expression using operands along- with. There are five types of arithmetical operands available in C++ which are as follows: (i) Add (+): To perform addition of operands. These operands can either be literal, identifier or combination of both. (ii) Subtract (-): In order to perform subtraction, operands can be literal, identifier or combination of both. (iii) Multiply (*): This operator performs multiplication on operands. (iv) Divide (/): It is used to perform division of the two operands. (v) Exponentiation (%): It is a modulus operator and returns the remainder of the division. A / operator returns the quotient after the division of operands and a modulus operator returns the remainder after division. |
|
| 3. |
WAP to sort the elements of an array in ascending order. |
|
Answer» #include<stdio.h> |
|
| 4. |
WAP to find the factorial of ‘n’. |
|
Answer» #include<stdio.h> |
|