C++ interview question:

How do you write a template for a function add that takes 2 params, if integers, returns the sum but if strings returns a concatenated string.

Tricky part: for an integer, one param is INT_MAX. What would be a proper return type so that the output is not something absurd as -2147483549?

Note: auto doesn't solve this.

Posting as :
works at
You are currently posting as works at

Check if either of one parameter is INT_MAX. If so then return that integer.

Then check below conditions before addition
If a and b are two integers! Then we can check like
a > INT_MAX - b
return INT_MAX

b> INT_MAX - a
return INT_MAX

Not sure if I am making sense here😐

Understood but the requirement is to promote the datatype if the result is beyond the limit. For example here the output should be 75000 but is not supported because of the limit of uint16.

Post Photo

Related Posts

What’s an appropriate comp package for an institutional investment management company in San Francisco? Interviewing for an associate director role and trying to understand salary.

like

Does anyone here work for ADP. I have an interview with them in a couple days for a SDR role. What are some good questions to ask during an interview

How long does it take to hear back for additional FDD interviews after you had your first interview (with just one person)? Assuming they are going to line up more interviews.

like

When should I tell my manager / “recommendor” I am planning to apply to bschool? Applying R1 this fall

like

In the process of interviewing for a strategy/Corp dev position at an activewear/athleisure company and they want me to think of a couple tangential industries that may have companies for acquisition and do a write up. I’m stumped on what else an activewear company would buy besides other activewear companies. I can only think of home fitness (Lulu’s Mirror) or vitamins/supplements. Any thoughts?

like

Question for yall. How likely is an offer once a company decides to do a reference check? I know I am in the final 2, from context clues in interviews. I just dont want to get my hopes up.

like

Anyone have any advice going into the mock/pitch portion of the interview?

like

Can anyone share the questions PwC AC Kolkata will ask for interview in assurance for CA as A2/SA1?

If an otherwise good interview the interviewer says: “I think you have great experience that will help you wherever you go”. Should I be reading into this?

like

have 3.1 years of experience and recently I have cleared the interview with Infosys for React developer position. However I have got the offer letter with the designation of senior associate consultant. Is this normal?

like

Hi sharks.... How long it takes for Global Logic to come back after Manager round? It's been 1week since I gave interview... No updates so far... GlobalLogic

Saw some posts about celonis across bowls - details for someone applying?

like

Hope all are safe!
Currently 5YOE in Mainframe Domain. Serving Notice period with 24 days left and Currently learning AWS cloud practioner from udemy(Stephane) and planning to do certification on that within next two weeks. Will it be possible for me to clear interviews saying 2YOE in Aws with a new profile in last two weeks of NP to enter into Aws cloud domain?
And could you please tell how the questions will be for 2 year experienced.

like

Hi all,i have been taking interviews for my department since the last 3 months.Should the company be paying me for the extra efforts?

like

Any insight into EY’s IFCS practice? Thinking of applying to their open staff role from another firm, I’d be transferring out of audit.

like

Interview coming up at Viacom. What’s the culture like these days? Fair comp? Is remote-only option available? Would be for a Director/Executive level role(s). TIA!

like

Hi everyone. What is the typical interview process like for tech Bizops roles? Are the case interviews similar to the ones we do in the consulting industry with the scenario based on the company we’re interviewing for? Thanks in advance.

likesmart

I have an interview at a place in NY I’ve always wanted to work at. Any pointers or recommendations for how to prepare?

like

How can you gauge whether a LMM pe shop with limited past employees has a good culture or not? I’m interviews with a few but feel like I have no clue if itll be sweaty, chill, etc. What questions can I ask to get insight into this?

More Posts

I tested positive on Friday for Covid. I have no symptoms- feel 100%. I can’t leave my studio apartment until Monday. Normally I run anywhere from 4-6 miles outside a day. Anyone have any suggestions on exercise classes that don’t require any equipment? Or just general ideas to keep moving?

like

Promoted to SSE with 25% hike and VP as 9% . I had received ACE award in Q3 . I have also maintained utilization report 100% still I got less VP. Can I ask manager to revisit the component

like

I'll be joining soon . looking for relocation allowance details as I need to move pune. When and how to check the status ?
Should I wait till ko joining as it will be virtual ?

like

Hello fellow EMBA 🐠

Was invited for a phone interview after resume screen with Sloan. They stated that my resume was "impressive" and that I may be a good fit. Cont...

like

Just got another rejection... Is exiting to FAANG or MB really this hard? Trying to go tech.. or mbb, but not getting anywhere. I have 2 masters (mba, ms) from top schools, been in consulting for over 10 years, I am confident that I know my stuff well..but still I keep getting rejected. Interviewed with Google, Amazon, Cisco, McKinsey, and a few others and every-time there is something that is not a match... are the hiring managers looking for like 100% match? That will never happen!!!

like

HR is scheduling the interviews without checking time with me. One interview was scheduled and then it was rescheduled to a different time at last minute. I wasn't available at that time so I mailed the HR for a different slot. They again scheduled it for a later date without checking the time with me.

like

Finally a new office space for Hyderabad folks! Anyone knows by when wfo will start?

What kind of behavior systems do you use in your classroom? I teach 1st grade. I’m tired of using the folder/calendar system with 🙂/🙁 and a prize box. Any ideas?

The argument that climate change is not man-made has been disproven by science over and over again, yet many people believe that the global crisis is either not real, not of our making, or both, in part because the news media deliberately chooses not to talk about it because it doesn't sell enough.

"Don't Look Up" is as real as it can be.

like

Rosemary encrusted Pork Chop with Creamy Polenta, Mushroom, Leeks, and Bacon

Post Photo
likesmart

Startup with US/UK presence looking to build out UK based devops team. Anyone, ideally with a US or UK security (SC/DV) clearance interested, please feel free to DM for more details.

like

I'm interested in starting a coaching business as a side hustle, has anyone does this? I was looking a Life Coach certifications. Thoughts?

like

I'm currently completing an executive coaching program and am looking for clients to gain experience and work towards my 100 hours needed for ICF credentials/certification.

If you're interested, please DM me to discuss. Thank you in advance for considering my request and supporting my goal of being a coach.

like

Curious to know what executive coaches charge, per hour, to work with senior leaders? If anyone feels comfortable sharing their own rate or what their company pays, I’d appreciate it.

like

I am interested in getting an executive career coach to help me understand how to get from where I am at now to an executive one day. I was wondering if anyone had any recommendations on company or a person

I work in security and would love one day to transition more of strategic business leader. I would want this career coach to understand the field and the path to success and have connections to be able to do this.

like

McKinsey & Company Hi, I am looking for a referral in McKinsey & Company for the position of graduate business analyst . I did my one year internship in Deloitte USI , just got converted Analyst (FTE) in march 2022. It would be very helpful.

like

Who has the best parental leave policies? Need advice

like

someone doesn't give af

like

what's the best app/site for planning an itinerary? I'd like to list all the things I want to see and be able to plan out the order by day. surely this must exist. tripit seems very manual/lacking.

like

I thought the answer is yes but now double checking. Can we write off the interest we pay on our primary residence mortgage?

like

Additional Posts in C++ Developers

Hi All , I am looking for switch with C++ skill set in linux/windows OS with 2 YOE , any organization having opening ?

This is a new group. Please add more people so that we can contribute to c++ development role availibilities and help each network with c++ developers worldwide.

like

Any openings in your respective organisations? I am serving a notice period

How Is the future of C++ language . I have been working on c++ for almost 1.5 years in a health care industry to maintain legacy code base.
But my current pay is only 10 lpa. While my friends in full stack developer role is earning twice my package .

So I am confused , will the package get better if I switch companies ???? Or is it better to switch the tech stack itself ????

I like c++ coding much more than any language .but package is also my concern.

Thanks in advance

like

Looking for C++ developers for India Bangalore location. Please reach out if interested or refer your friends to me.

like

Hi All,

I got offer from Fujitsu for C++ developer i feel that it's a good opportunity to learn new skills along with C++.
I already have 9.1LPA + 35K yearly incentive and i got 12LPA Fixed in Fujitsu.

YOE: 3.6 years

I'm in process of making a decision. Please help.

Is Fujitsu good company for career development nd learn new skills?

I have been told by the HR that they have yearly two appraisal policy in Fujitsu, is this correct?

like

What should be the stipend for an intern (compiler engineer) in Bangalore ?

What type of Questions are asked on Managerial Round of Robert Bosch.
Does it involve technical concepts as well or it's purely Managerial based questions.

Kindly revert.

like

Hi,
I have 3+ years of experience in c++ developer . Please let me know if there are openings available, looking for Pune location and remote.

Has anyone tried turing jobs here?
It is really hard to find C++ jobs these days.
Are there any remote jobs even available?

Nielson - 27 fixed + 3 variable + 2 JB
Genesys - still negotiating on this
KPIT - 28 - Fixed
Genesys Telecommunications Laboratories Inc
Nielsen
KPIT
Which one is better? YOE 8 yrs 8 months

Any openings for C++ Developer role??
Yoe 5.5 Years
Thanks in Advance

like

Hi Fishes,

I am looking for remote based job with C++ skill set.

Any chance i will get , please update your suggestions regarding organization name.

YOE : 7.2 years.

like

We have couple of vacancies for C++ developer in L&T technology services. Let me know if anybody is interested. Airoli, Navi Mumbai location.

like

New to Fishbowl?

Download the Fishbowl app to
unlock all discussions on Fishbowl.
That was just a preview…
Sign Up to see all discussions
  • Discover what it’s like to work at companies from real professionals
  • Get candid advice from people in your field in a safe space
  • Chat and network with other professionals in your field
Sign up in seconds to unlock all discussions on Fishbowl.

Already a user?
Login here

Share

Embed this post

Copy and paste embed code on your site

Preview

Download the
Fishbowl app

See what’s happening in your industry
from the palm of your hand.

A phone with Fishbowl app

Scan your QR code to download
Fishbowl app on your mobile

Download app

Sign up for free to view this conversation on Fishbowl

By continuing you agree to Terms of Use and Privacy Policy

Already have an account? Log in

Sign up for free to continue using Fishbowl

By continuing you agree to Terms of Use(New) and Privacy Policy(New)
Messaging rates may apply

Already have an account? Log in

For account settings, visit Fishbowl on Desktop Browser or

General

Legal