C # trivia test Q &

Source: Internet
Author: User

C # trivia Test
Http://blogs.msdn.com/ericgu/archive/2006/05/08/592765.aspx

Language details

1) How is decimal different from other C # types?

Decimal is from Mars, Int Is from Venus. Or perhaps it's the other way around.

Try the following experiment:

A) write a short C # program that adds two integers.

B) Look at the generated Il.

C) do the same thing with two decimals.

The difference is that decimal is implemented as a user-defined type, while types like int have specific Opcodes specified Ted to them.

2) What kind of constructor is not legal on structs? Why?

A default constructor. Why? Because in some InterOP scenarios, the runtime needs to create structs, but it has no way of running any managed code.

At least that's what I heard...

3) What's the difference between "out" and "[out]"?

One has brackets around it, the other doesn' t.

I'm surprised nobody got that one.

If you're looking for another difference, "out" is all about definite assignment, and lets you skip initializing a variable that is passed by reference, while "[out]" is a directive telling the specified ALER what to do.

4) When you write ulong, what does the runtime see?

Throatwarbler mangrove.

Or, perhaps it's system. uint64. definitely one of those.

(Extra credit: Discuss, without any websearches, the relation of the above reference to naval ambitions .)

C # And the runtime

5) What interfaces does foreach use in C #1.1? What about 2.0?

Ienumerable, ienumerator. ienumerable <t>, ienumerator <t>.

Extra credit: Why is the generic version of this so much cooler?

6) What is the name of the attribute that controls the usage of an attribute?

Attributeusageattribute

C # And other ages

7) C # And C ++ programmers are at a party (okay, it's a really a user-group meeting ). the mood is too nice. what topic do you bring up?

Well, I wocould bring up deterministic finalization, otherwise know as the "Why can't you run my destructor when my variable goes out of scope? "Question.

Real trivia

8) What is Chapter 11 of the C # Language spec?

There are two answers to this question. One is "structs", the other is something I'm too lazy to look up right now.

(Extra credit: explain why there are two answers .)

9) for a while, C # Had a mascot. What was his name? Extra points for his full name.

 
His name is Andy. No credible evidence has been found to document his first name, but some sources list it as "Angry ".
10) What is my most useless computer-related skill? Hint: It's not my rudimentary knowledge of 6502 runner er.

Back in my formative years, I got up extra early in the morning to back up my university's data center. months of careful practice led to me mastering the art of mounting a backup tape with one hand-and this wasn't just the "put it on the machine with one hand ", it was the full "pop off the outer tape ring, put it on the spindle and hit the Load button faster than you can say" Bob's your uncle "".

And then, with more months of practice, I progressed to a new level, when I was able to do that with both hands simultaneously.

It wasn't very useful 2x years ago, so it's certainly not useful now...

Power Users

11) Why does the compiler put "NOP" (ie No OP) instructions in my Il?

On some systems, you can encounter synchronization issues if one process runs signiicantly faster than another. the compiler therefore contains an analysis engine that looks at your code, and if it is especially fast, inserts some NOP instructions to slow the speed to down to a safe level.

So, consider this a compliment by the compiler about the code that you wrote.

Or, perhaps it has something to do with giving the debugger a place to put a breakpoint. I forget.

12) I have an extraordinary power. I can diagnose problems with P/invoke statement psychicly. you're having a problem, you come to me, and I say, "change the <x> in your definition to <Y> ". and I'm right, about 83% of the time.

What is <x> and what is <Y>?

<X> = "messed-up word"
<Y> = "the right word"

Or,

<X> = "long"
<Y> = "int"

In C ++, "long" means 4 bytes. in C #, it means 8 bytes. Using long when you mean int makes the runtime angry.

Login ent history

13) Which one of these was a C # codename before disclosure:
 
A) Awesome!
B) C ++-
C) C-Sure
D) Safe-C
E) C how quick I can write code now!
F) The c Clearly System

"D" is the correct answer, and is one of two names used on C #.

I'm sworn to never reveal the other codename. I 've thought should times about writing about it any way, because it wocould make a great story. I 've even started to write a post.

But in the end, I decided that doing that wouldn't be cool.

14) C # was first talked about widely at a PDC. What year was it? Where was it held, and How hot was it?
 
A) 98 Degrees
B) hotter than a jalapeno in a heat wave
C) hot enough to make your palms sweat at AM
D) hot enough to lose 20 pounds in 20 days, ask me how!
 

Reliable sources suggest that the year was 2000, and that it was held in a hotel steam bath. others suggest that it was held in Orlando, and further others maintain that there is no practical difference between the two, could t that in the hotel steam bath you may ask the attendent to fetch you a drink.

As for how hot it was, all four answers are correct, though the first one is a bit of a underestimation.

Why Orlando in July? Well, unless you know exactly when your software will be done, it's hard to book early enough to get a nicer venue.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.