Languages [TCS Placement]: Sample Questions 13 - 15 of 131

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 13

Describe in Detail Essay▾

What are reserved words?

Edit

Explanation

  • Reserved words are that are part of the standard C language library.
  • Reserved words have special meaning and cannot be used for purposes other than what they are originally intended.
  • Examples of reserved words are int, void, and return.
Given the Image is Define the C Keyword or Reserved Word

Question 14

Write in Short Short Answer▾

What is the benefit of using an enum rather than #define constant?

Edit

Explanation

  • The use of an enumeration constant (enum) has many advantages over using the traditional symbolic constant style of #define.
  • These advantages include a lower maintenance requirement, improved program readability, and better debugging capability.
    • Enumerated constants are generated automatically by the compiler. Conversely, symbolic constants must be manually assigned values by the programmer.
    • Enumeration constant makes programs more readable and thus can be understood better.

Question 15

Write in Short Short Answer▾

Which bit wise operator is suitable for checking whether a particular bit is on or off?

Edit

Explanation

The bitwise AND operator. Here is an example:

  1. enum
  2. {
  3. KBit0 =1,KBit1,…..…KBit31,
  4. };if ( some_int & KBit24 )printf (“Bit number 24 is ON”);elseprintf (“Bit number 24 is OFF”);