0% found this document useful (0 votes)
60 views2 pages

Solution TCS: Aptitude

The document contains solutions to aptitude and coding questions, including explanations for compiler errors, ways to access array elements, comparing floating point numbers, static variables, pointer assignments, sorting algorithms, tree traversals, and antonym and synonym questions. It provides the answers to coding questions related to topics like data structures, algorithms, C programming, and logical reasoning. The explanations give the reasoning behind the solutions to various problems related to programming concepts.

Uploaded by

arunsmile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views2 pages

Solution TCS: Aptitude

The document contains solutions to aptitude and coding questions, including explanations for compiler errors, ways to access array elements, comparing floating point numbers, static variables, pointer assignments, sorting algorithms, tree traversals, and antonym and synonym questions. It provides the answers to coding questions related to topics like data structures, algorithms, C programming, and logical reasoning. The explanations give the reasoning behind the solutions to various problems related to programming concepts.

Uploaded by

arunsmile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

SOLUTION

TCS: Aptitude
1. After 100 s
2. 171 m
3. 11,5
4. 48
5. 9
6. 62.5%
7. 3 pm
8. 55
9. 16
10. 1590
CTS:
5 B, 6- D, 7- A, 8- E, 9- B, 10- D
C
1.

Compiler error: Cannot modify a constant value.


Explanation:
p is a pointer to a "constant integer". But we tried to change the value of
the "constant integer".
2. mmmm
aaaa
nnnn
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea.
Generally array name is the base address for that array. Here s is the base address. i is the
index number/displacement from the base address. So, indirecting it with * is same as
s[i]. i[s] may be surprising. But in the case of C it is same as s[i].
3. I hate U
Explanation:
For floating point numbers (float, double, long double) the values cannot
be predicted exactly. Depending on the number of bytes, the precession with of the value
represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9
with less precision than long double.
Rule of Thumb:
Never compare or at-least be cautious when using floating point numbers
with relational operators (== , >, <, <=, >=,!= ) .
4.

54321
Explanation:
When static storage class is given, it is initialized once. The change in the
value of a static variable is retained even between the function calls. Main is also treated
like any other ordinary function, which can be called recursively.

5.

2222223465
Explanation:
Initially pointer c is assigned to both p and q. In the first loop, since only
q is incremented and not c , the value 2 will be printed 5 times. In second loop p itself is
incremented. So the values 2 3 4 6 5 will be printed.
Data Structures
2. O(n log n)
3. Heap sort
4. Inorder
5. (b)
ANTONYM:
D, A, B, B, E, A, E, D, B, E, D, C, C, C, C.
SYNONYM
1
2
3
4
5
6
7
8
9
10

Desertion
Follow
Keen, eager
Clumsy, vulgar
Essential
Flashy, showy
Narrow minded
Irregular, broken
Fear
Illegal trade

You might also like