TomoLink
TCS NQT GuideTCS NQT Programming Logic & CS FundamentalsArrays and Strings Operations Programming Logic

Arrays and Strings Operations Programming Logic

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

Key Concepts & Formulas

  • 1Array index starts at 0, name of array is a pointer to the first element.
  • 2Strings in C are null-terminated character arrays.

TCS NQT Style Practice Questions

Practice Question 1

What is output: int arr[3]={1,2,3}; printf("%d", *(arr+1));

A) 2
B) 1
C) 3
D) Address of arr

Correct Answer: A) 2

Step-by-step Solution: *(arr+1) is equivalent to arr[1]. arr[1] is 2.

Practice Question 2

How is string 'OK' stored in memory array?

A) ['O', 'K', '\0']
B) ['O', 'K']
C) ['\0', 'O', 'K']
D) ['O', '\0', 'K']

Correct Answer: A) ['O', 'K', '\0']

Step-by-step Solution: All C strings are appended with a terminating null character ('\0') to mark the end of string.

Study Pro-Tip

Array address index formula: *(arr + i) = arr[i] holds universally in C.