TCS Papers: Sample Questions 207 - 209 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 207

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

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

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 ”);

Question number: 208

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is a newline escape sequence?

Explanation

  • A newline escape sequence is represented by the character.

  • Used to insert a new line when displaying data in the output screen.

  • More lines can be added by inserting more characters.

  • For example, would insert two lines.

  • A newline escape sequence can be placed before the actual output expression or after.

Newline escape sequence

Newline Escape Sequence

Given the image is defining the , which is a new line character.

Question number: 209

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

How do you construct an increment statement or decrement statement in c?

Explanation

  • There are actually two ways you can do this.

  • One is to use the increment operator ++ and decrement operator –.

  • For example, the statement “x++” means to increment the value of x by 1.

  • Likewise, the statement “x-” means to decrement the value of x by 1.

  • Another way of writing increment statements is to use the conventional + plus sign or - minus sign.

Increment and decrement operators program

Increment and Decrement Operators Program

Given the example of increment and decrement operators program