Elements of C - Short Questions and Answers

 

Elements-of-C-short-questions-answers

Elements of C - Short Questions and Answers. This is the 2nd 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 important for the final examinations of all Boards of Pakistan:


Chapter No.9: Elements of C

Short Questions and Answers - 2

Q.1: Define data types for integers?

Answer:

The data type int is used to represent integers – the whole numbers. This means that int variables store numbers that have no fractional parts such as 1128, -1025, etc. Along with standard type int, the compiler also supports two more types of integers i.e. short int and long int. The data types signed int and int can handle both signed and unsigned whole numbers such as 245, -150, etc., whereas the data type unsigned can not handle negative numbers.

 

Q.2: Define data types for floating-point numbers?

Answer:

Floating-point numbers are the numbers that have a fractional part e.g., 12.359, and -8.64, etc. ANSI C specifies three floating-point types that differ in their memory requirements: float, double, and long double. These data types provide higher precision than the data types used for integers.

 

Q.3: Define data type for characters?

Answer:

The data type char is used to represent a letter, number, or punctuation mark. A char data type variable occupies 1 byte in memory and can represent individual characters such as ‘a’, ‘c’ and ‘$’ etc.

 

Q.4:What is arithmetic underflow?

Answer:

When two very small numbers are manipulated, the result may be too small to be represented accurately, so it will be represented as zero. This phenomenon is called arithmetic underflow.

 

Q.5: What is arithmetic overflow?

Answer:

Manipulation of two very large numbers may result to a too large number to be represented. This phenomenon is called arithmetic overflow.

 

Q.6: What are the operators?

Answer:

Operators are symbols, which are used to perform certain operations on data. C is equipped with a rich set of operators e.g. arithmetic operators, relational operators, logical operators, bitwise operators, and many others.

 

Q.7: What is the modulus (remainder) operator?

Answer:

Contrary to the division operator, which returns the quotient, it returns the remainder of an integral division. For example, if a and b are two integers having values 8 and 3 respectively, then the express a % b will be evaluated to 2, which is the remainder of the integral division.

 

Q.8: What are relational operators?

Answer:

Relational operators are used to compare two values. These operators always evaluate to true or false. There are six basic relational operators in C i.e. ==, <, >, <=, >=, and != .

 

Q.9: Define logical operators?

Answer:

Logical operators combine two or more relational expressions to construct compound expressions. The logical operators are && (logical AND), || (logical OR), and ! (logical NOT). The logical operators always evaluate to true or false.

 

Q.10: Differentiate between Logical ‘AND’ and Logical ‘OR’ operators?

Answer:

Logical&& (logical AND) Operator:When combines two conditions, evaluates to true if both the conditions are true, otherwise, it evaluates to false.

Logical || (logical OR) Operator: When combines two conditions evaluate to true if any one of the conditions evaluate to true, otherwise, it evaluates to false.

 

Q.11: Define ! (logical NOT) operator?

Answer:

The logical operator ! (logical NOT) when applied toa condition, reverse the result of the evaluation of the condition, this means that if the condition evaluates to true, the logical NOT operator evaluates to false and vice versa.

 

Q.12: What is an assignment operator?

Answer:

The assignment operator is used to store a value or a computational result in a variable. The symbol = represents the assignment operator. For example:

Area = height * width;

 

Q.13: Differentiate between increment and decrement operators?

Answer:

The increment operator increases the value of its operand by one whereas the decrement operator decreases the value of its operand by one. These are denoted by the symbol ++ and _ _ respectively.

 

Q.14: Differentiate between prefix and postfix increment operator?

Answer:

When ++ precedes its operand, it is called prefix increment. When the ++ follows its operand, it is called postfix increment.

 

Q.15: What are compound assignment operators?

Answer:

There are four compound assignment operators that can increment or decrement the value of their operand by other than one. These are +=, -=, *= and /= operators.


Note: The remaining short questions and answers of this chapter will be published soon InshaAllah, therefore keep stay tuned for further short questions and MCQs || Online Quiz.


➤ Elements of C - MCQs

➤ Elements of C - Short Questions Set-I

➤ Elements of C - Short Questions Set-III

➤ Getting Started With C - Short Questions

➤ Getting Started With C - MCQs

➤ Input/Output - MCQs | Quiz

➤ Input/Output - Short Questions

➤ Input/Output - Exercise Programs


7 Comments

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

Post a Comment

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

Previous Post Next Post