I have entered my final year in my B.Tech course, and with it, it’s placement time. Companies for the computer science stream (my stream) will start visiting my college beginning from 11th August. The first to come will be TCS (Tata Consultancy Services) which is considered as a good IT firm in India with global fame.
As part of my prep for the placements, obviously, I am revising my concepts (technical ones). Today, as it was raining heavily in the college, we sat in our central canteen, waiting for the rain to stop. During that time, we held a heated discussion on C++ programs that were most likely to be asked in interviews for placements.
Amongst those programs, one was to swap the values of two variables “a” and “b” without using the “temp” variable. Another interested one we discussed was that would generate a pattern like:
4 5 6
7 8 9 10
11 12 13 14
…… and so on.
When I got back home, I decided to have a go on these programs. And so, here are my answers to above problems.