TomoLink
TCS NQT GuideTCS NQT Programming Logic & CS FundamentalsInbuilt Libraries and Functions (String.h, Math.h, etc.)

Inbuilt Libraries and Functions (String.h, Math.h, etc.)

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

Key Concepts & Formulas

  • 1strlen() returns length of string excluding null terminator.
  • 2strcpy(dest, src) copies src string including null terminator to dest.
  • 3strcmp(s1, s2) returns 0 if strings are identical.

TCS NQT Style Practice Questions

Practice Question 1

What is the output of strlen("TCS\0NQT")?

A) 3
B) 6
C) 7
D) 4

Correct Answer: A) 3

Step-by-step Solution: strlen reads until the first null terminator ('\0'). In 'TCS\0NQT', it stops after 'TCS', returning 3.

Practice Question 2

What does strcmp("abc", "abc") return?

A) 0
B) 1
C) -1
D) Any positive number

Correct Answer: A) 0

Step-by-step Solution: strcmp returns 0 if the two strings are equal.

Study Pro-Tip

Remember that string lengths exclude the terminating null character ('\0').