Originally posted by Durbs
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
C# interview question
Collapse
X
-
-
No offence, but how do you lot get paid money for programming in a C based language and not know the simple operators? It's a clever question: obviously the intent is to ascertain whether you're the sort of programmer who'd read a book or paid for a course, or whether you're the sort of programmer who really understands what they're doing.
<<4 is a faster way of doing *16 for integers (although to be fair that's probably not a factor in this day and age). Or it could be to do with some bitwise calculation, or when dealing with nibbles for some reason (parsing a hex value springs to mind).Will work inside IR35. Or for food.Comment
-
Originally posted by VectraMan View PostNo offence, but how do you lot get paid money for programming in a C based language and not know the simple operators? It's a clever question: obviously the intent is to ascertain whether you're the sort of programmer who'd read a book or paid for a course, or whether you're the sort of programmer who really understands what they're doing.
<<4 is a faster way of doing *16 for integers (although to be fair that's probably not a factor in this day and age). Or it could be to do with some bitwise calculation, or when dealing with nibbles for some reason (parsing a hex value springs to mind).
If someone wrote that instead of *16, I'd make them change it. Clarity is more important than nanoseconds in all but the tiniest minority of uses.Comment
-
Originally posted by VectraMan View PostNo offence, but how do you lot get paid money for programming in a C based language and not know the simple operators? It's a clever question: obviously the intent is to ascertain whether you're the sort of programmer who'd read a book or paid for a course, or whether you're the sort of programmer who really understands what they're doing.
<<4 is a faster way of doing *16 for integers (although to be fair that's probably not a factor in this day and age). Or it could be to do with some bitwise calculation, or when dealing with nibbles for some reason (parsing a hex value springs to mind).Comment
-
Originally posted by Gentile View PostWhat, you mean for those situations where int.Parse(hexValueAsString, System.Globalization.NumberStyles.HexNumber) just isn't clever or obscure enough?
What if a programmer didn't know about loops, because they'd never had to use one? After all, you could probably do a lot of business applications getting by with just ifs and else, and calling other people's functions. That's how this thread sounds to me.Will work inside IR35. Or for food.Comment
-
Originally posted by VectraMan View PostAll programming is easy if somebody else has already done the work for you. But what about the occasions where the thing you need doesn't already exist?
What if a programmer didn't know about loops, because they'd never had to use one? After all, you could probably do a lot of business applications getting by with just ifs and else, and calling other people's functions. That's how this thread sounds to me.Comment
-
Originally posted by k2p2 View PostAnyone got a real world example where it would be useful?
Other than that, it's not used for much.Comment
-
Although I agree that interviewers should not try and look clever than the person they are trying to interview, I would say that anything on this page is fair game when questioning medium to high level c# programmers:
C# Operators (C#)
and you should have proposed a conciser rewrite:
int i = 500;
i << = 4;Coffee's for closersComment
-
Originally posted by Durbs View PostHad a tech test today which was in the main ok. One question though did my head in, I was asked something like:
int i = 500;
i = i << 4;
Tell us what i is.
What the hell is the << operator, its probably something dead obvious but I seem to have gone through my career without using << ?Comment
-
Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Andrew Griffith MP says Tories would reform IR35 Oct 7 00:41
- New umbrella company JSL rules: a 2026 guide for contractors Oct 5 22:50
- Top 5 contractor compliance challenges, as 2025-26 nears Oct 3 08:53
- Joint and Several Liability ‘won’t retire HMRC's naughty list’ Oct 2 05:28
- What contractors can take from the Industria Umbrella Ltd case Sep 30 23:05
- Is ‘Open To Work’ on LinkedIn due an IR35 dropdown menu? Sep 30 05:57
- IR35: Control — updated for 2025-26 Sep 28 21:28
- Can a WhatsApp message really be a contract? Sep 25 20:17
- Can a WhatsApp message really be a contract? Sep 25 08:17
- ‘Subdued’ IT contractor jobs market took third tumble in a row in August Sep 25 08:07
Comment