Elements of C Short Question Answers-3


Elements of C - Short Questions and Answers. This is the 3rd  post about 2nd Year | ICS Part-II Computer Science Chapter No.9: (Elements of C) | Short Questions and Answers.

 

The following objective questions (short questions and answers) are very important for the final examinations of all Boards.


elements of c short question answers, ICS Part-II


Chapter No.9: Elements of C

Short Questions and Answers - 3

Q.1: Define the statement j += 5; ?
Answer:
The statement j += 5 increases the value of j by 5. For example, if value of j = 10 then the value of j = 15 after the execution of above statement.  
 
Q.2: What is the operator’s precedence?
Answer:
An operator’s precedence determines its order of evaluation in an expression.
 
Q.3: Write the order of operator’s precedence from highest to lowest?
Answer:
The order of operator’s precedence from highest to lowest is as under:
  • ! (logical NOT operator)
  • *, /, % (modulus or remainder operator)
  • +, -
  • <, <=, >, >=
  • == (equal), != (not equal)
  • && (logical AND operator)
  • || (logical OR operator)
  • = (assignment operator)
 
Q.4: What are unary operators?
Answer:
The unary operators are those operators that have just one operand. The example of unary operators is logical NOT, increment and decrement operator.
 
Q.5: What are binary operators?
Answer:
The binary operators are those operators that have two operands. The example of binary operators is arithmetic operators, relational operators, logical AND, logical OR and the assignment operator.
 
Q.5: What is ternary operator?
Answer:
The ternary operator is an operator that has three operands or arguments. The example of ternary operator in C language is conditional operator.
 
Q.6: Define the working with division operator?
Answer:
The manipulation of division operation is slightly different from other arithmetic operations in C. when the divisor and the dividend both are integers, the fractional part of the quotient is truncated.
 
Q.7: Differentiate between 7.0 / 2.0 and 7 / 2 statements?
Answer:
The result value of 7.0 / 2.0 is 3.5 but the value of 7 / 2 is the integral part of the result i.e. 3. The fractional part of the result i.e. .5 is truncated.
 
Q.8: What are the values of a and b after execution? Let a and b be two variables of type double and int respectively:
Answer:
Let,
a = 5 * 0.5;
b = 5 * 0.5;
After execution:
a = 2.5
b = 2
 
Q.9: What are the comments?
Answer:
The comments are used increase the readability of the program. With comments, informative notes are inserted in the program’s code, which helps in debugging and modifying the program. There are two types of comments in C:
  • Single line comments
  • Multiline comments
 
Q.10: differentiate between single-line comments and multi-line comments?
Answer:
  • Single-line comments:
One can insert single-line comments by typing two forwards slashes at the start of the note such as:
//            This is an example of single-line comment.
  • Multi-line comments:
Multi-line comments are used to add such informative notes which extend to multiple lines. It can be inserted to the code by placing /* characters at the beginning of the comments, this is called opening of the multi-line comments. Each multi-line comment must end with letters */.
/*
Line – 1: This is an example of multi-line comments.
.
.
.
Line – N: This is an example of multi-line comments.
*/

 

Attempt MCQs | Quiz of  Computer Science ICS, Part-II

Post a Comment

Your feedback is highly appreciated and will help us to improve. So, please give your good suggestions.

Previous Post Next Post