TomoLink
TCS NQT GuideTCS NQT Coding Capability & AlgorithmsNumber Conversions (Decimal to Binary/Octal/Hexadecimal) Code

Number Conversions (Decimal to Binary/Octal/Hexadecimal) Code

Learn core concepts, essential formulas, and attempt practice questions designed on the latest TCS NQT testing patterns.

Key Concepts & Formulas

  • 1Decimal to Binary: Divide by 2 repeatedly and capture remainders from bottom to top.
  • 2Hex conversion uses characters 'A'-'F' to represent values 10-15.

TCS NQT Style Practice Questions

Practice Question 1

What is the binary representation of decimal 13?

A) 1101
B) 1011
C) 1111
D) 1001

Correct Answer: A) 1101

Step-by-step Solution: 13/2 = 6 (rem 1), 6/2 = 3 (rem 0), 3/2 = 1 (rem 1), 1/2 = 0 (rem 1). Reading remainders bottom-up yields 1101.

Practice Question 2

Decimal value of binary 1010 is:

A) 10
B) 5
C) 12
D) 8

Correct Answer: A) 10

Step-by-step Solution: 1*2^3 + 0*2^2 + 1*2^1 + 0*2^0 = 8 + 0 + 2 + 0 = 10.

Study Pro-Tip

Use bitwise shift operators (>> 1) as a high-speed replacement for division by 2.