473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Question from a test

Hello,

I got a test and some of the questions were:

A collection a files, which is the basic unit of .NET programming, is
called:
1. package
2. assembly
3. library
4. copybook

I chose 3.

Every attribute must have at least one of the following:
1. comment
2. constructor
3. virtual machine
4. database

I put the finger on 3, as I had no idea what else to choose.

I do not know exactly how they help a programmer but it is good to know the
right answer. Can anybody give a hint please?
Thank you!
Apr 21 '06 #1
11 1469

"Doru Roman" <do*******@rogers.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello,

I got a test and some of the questions were:

A collection a files, which is the basic unit of .NET programming, is
called:
1. package
2. assembly
3. library
4. copybook

I chose 3.

I would have to fight on either answer here. If someone answered #2, I
would have to say they are right as well as #3. An assembly is a file that
contains a compiled version of a collection of code files while a library
can be the same thing (DLL = Dynamic-Linked Library), or a collection of
assemblies (library of DLL's)...but i guess it depends on what the test is
for....Now, for the basic unit of .Net programming, an assembly would be my
guess of what the testers are looking for.
Every attribute must have at least one of the following:
1. comment
2. constructor
3. virtual machine
4. database
Attributes *must* have a constructor. If it does not, it can't be created,
therefore you can't place the attribute on any code type.
I put the finger on 3, as I had no idea what else to choose.

I do not know exactly how they help a programmer but it is good to know
the
right answer. Can anybody give a hint please?
Thank you!


Wonders if this is for a job position and I just gave you the answers to it
:P

HTH,
Mythran

Apr 21 '06 #3
Now I understand what an attribute means. If I had known at the test time I
would have chosen
the right answer too.
If in C++ they were fields, now in C# they are attributes.
"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:OJ**************@TK2MSFTNGP02.phx.gbl...

"Doru Roman" <do*******@rogers.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello,

I got a test and some of the questions were:

A collection a files, which is the basic unit of .NET programming, is
called:
1. package
2. assembly
3. library
4. copybook

I chose 3.


I would have to fight on either answer here. If someone answered #2, I
would have to say they are right as well as #3. An assembly is a file
that contains a compiled version of a collection of code files while a
library can be the same thing (DLL = Dynamic-Linked Library), or a
collection of assemblies (library of DLL's)...but i guess it depends on
what the test is for....Now, for the basic unit of .Net programming, an
assembly would be my guess of what the testers are looking for.
Every attribute must have at least one of the following:
1. comment
2. constructor
3. virtual machine
4. database

Attributes *must* have a constructor. If it does not, it can't be
created, therefore you can't place the attribute on any code type.
I put the finger on 3, as I had no idea what else to choose.

I do not know exactly how they help a programmer but it is good to know
the
right answer. Can anybody give a hint please?
Thank you!


Wonders if this is for a job position and I just gave you the answers to
it :P

HTH,
Mythran

Apr 21 '06 #4
Thanks Mythran
"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:OJ**************@TK2MSFTNGP02.phx.gbl...

"Doru Roman" <do*******@rogers.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello,

I got a test and some of the questions were:

A collection a files, which is the basic unit of .NET programming, is
called:
1. package
2. assembly
3. library
4. copybook

I chose 3.


I would have to fight on either answer here. If someone answered #2, I
would have to say they are right as well as #3. An assembly is a file
that contains a compiled version of a collection of code files while a
library can be the same thing (DLL = Dynamic-Linked Library), or a
collection of assemblies (library of DLL's)...but i guess it depends on
what the test is for....Now, for the basic unit of .Net programming, an
assembly would be my guess of what the testers are looking for.
Every attribute must have at least one of the following:
1. comment
2. constructor
3. virtual machine
4. database

Attributes *must* have a constructor. If it does not, it can't be
created, therefore you can't place the attribute on any code type.
I put the finger on 3, as I had no idea what else to choose.

I do not know exactly how they help a programmer but it is good to know
the
right answer. Can anybody give a hint please?
Thank you!


Wonders if this is for a job position and I just gave you the answers to
it :P

HTH,
Mythran

Apr 21 '06 #5

"Doru Roman" <do*******@rogers.com> wrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
Now I understand what an attribute means. If I had known at the test time
I would have chosen
the right answer too.
If in C++ they were fields, now in C# they are attributes.


An attribute is not a field :)

An attribute is a class that you place on a class, method, or other member
that signifies to the framework (or custom code) to do something or another
(or just flags it as something important)...excerpt from the MSDN
documentation:

"The common language runtime allows you to add keyword-like descriptive
declarations, called attributes, to annotate programming elements such as
types, fields, methods, and properties. Attributes are saved with the
metadata of a Microsoft .NET Framework file and can be used to describe your
code to the runtime or to affect application behavior at run time. While the
..NET Framework supplies many useful attributes, you can also design and
deploy your own."

In C#, you apply attributes (such as the DescriptionAttribute) as follows:

[Description("This is a description for the following property.")]
public int MyInt
{
get {
return mMyInt;
}
}

There are also attributes in the AssemblyInfo file that affect the entire
assembly, such as AssemblyKeyName or AssemblyKeyFile. Others allow you to
document (in the metadata) the product name, version, description, copyright
information, and so on.

They don't just stop there. There are attributes that tell the framework
that you have to have a specific permission in order to create a class,
access a method / property, and so on. Attributes are powerful elements in
..Net that help you create assemblies for your clients/customers.

HTH,
Mythran

Apr 21 '06 #6
Now the confusion grows bigger.
When I spoke about "field" I was thinking of variables from C++, my mistake.
But I just took a look on the MS Visual C# .NET Unleashed - Hoffman & Kruger
and they refer to Class Attributes as physical characteristics of a class,
which
can be as simple as the color of an object or as complex as a contained
object or class.
You seem to refer to something like this:
[DllImport("user32.dll", SetLastError=false, ExactSpelling=false)]
or
[AttributeUsage(AttributeTargets.Class|AttributeTar gets.Struct,
AllowMultiple=true)]
Now in the light of the question from the test could you please explain
again what the
right answer is?
Is it a comment or a constructor and to what "ATTRIBUTE" it refers to?
"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:e6**************@TK2MSFTNGP04.phx.gbl...

"Doru Roman" <do*******@rogers.com> wrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
Now I understand what an attribute means. If I had known at the test time
I would have chosen
the right answer too.
If in C++ they were fields, now in C# they are attributes.


An attribute is not a field :)

An attribute is a class that you place on a class, method, or other member
that signifies to the framework (or custom code) to do something or
another (or just flags it as something important)...excerpt from the MSDN
documentation:

"The common language runtime allows you to add keyword-like descriptive
declarations, called attributes, to annotate programming elements such as
types, fields, methods, and properties. Attributes are saved with the
metadata of a Microsoft .NET Framework file and can be used to describe
your code to the runtime or to affect application behavior at run time.
While the .NET Framework supplies many useful attributes, you can also
design and deploy your own."

In C#, you apply attributes (such as the DescriptionAttribute) as follows:

[Description("This is a description for the following property.")]
public int MyInt
{
get {
return mMyInt;
}
}

There are also attributes in the AssemblyInfo file that affect the entire
assembly, such as AssemblyKeyName or AssemblyKeyFile. Others allow you to
document (in the metadata) the product name, version, description,
copyright information, and so on.

They don't just stop there. There are attributes that tell the framework
that you have to have a specific permission in order to create a class,
access a method / property, and so on. Attributes are powerful elements
in .Net that help you create assemblies for your clients/customers.

HTH,
Mythran

Apr 22 '06 #7
"Doru Roman" <do*******@rogers.com> wrote:
[DllImport("user32.dll", SetLastError=false, ExactSpelling=false)]
or
[AttributeUsage(AttributeTargets.Class|AttributeTar gets.Struct)]


When talking about C#, an attribute is unambiguously this kind of
thing.
These attributes can apply to classes, members, namespaces &c. You
think of them as compile-time directives about that
class/member/namespace. However, their special feature is that
developers can add their OWN attributes. (imagine if you could add
compile-time directives to C!...) How do developers provide their own
attributes? -- answer: by implementing the attribute itself as an
object class. And, being a class, of course the attribute has a
constructor. Every class has a constructor. So that's your answer.

--
Lucian
Apr 22 '06 #8
Thanks Lucian.
"Lucian Wischik" <lu***@wischik.com> wrote in message
news:7p********************************@4ax.com...
"Doru Roman" <do*******@rogers.com> wrote:
[DllImport("user32.dll", SetLastError=false, ExactSpelling=false)]
or
[AttributeUsage(AttributeTargets.Class|AttributeTar gets.Struct)]


When talking about C#, an attribute is unambiguously this kind of
thing.
These attributes can apply to classes, members, namespaces &c. You
think of them as compile-time directives about that
class/member/namespace. However, their special feature is that
developers can add their OWN attributes. (imagine if you could add
compile-time directives to C!...) How do developers provide their own
attributes? -- answer: by implementing the attribute itself as an
object class. And, being a class, of course the attribute has a
constructor. Every class has a constructor. So that's your answer.

--
Lucian

Apr 22 '06 #9
Lucian Wischik <lu***@wischik.com> wrote:

<snip>
And, being a class, of course the attribute has a
constructor. Every class has a constructor. So that's your answer.


Careful - that's not quite true any more. Static classes (new in C#
2.0) don't have constructors.

Now, static classes always derive directly from object, so it's not an
issue here - I'm only disputing the "Every class has a constructor"
statement.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 22 '06 #10
Then what would be the answer to the question?
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Lucian Wischik <lu***@wischik.com> wrote:

<snip>
And, being a class, of course the attribute has a
constructor. Every class has a constructor. So that's your answer.


Careful - that's not quite true any more. Static classes (new in C#
2.0) don't have constructors.

Now, static classes always derive directly from object, so it's not an
issue here - I'm only disputing the "Every class has a constructor"
statement.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Apr 22 '06 #11
Doru Roman <do*******@rogers.com> wrote:
Then what would be the answer to the question?


The same as it was before. Every attribute class does indeed have a
constructor, but not all classes have constructors.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 22 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Weekend | last post by:
Currently, i want to develope a multiple choice exam website. The content of the test is store in an XML file. I want to carry out some function. Could you tell me which programming language should...
4
by: Tony Johansson | last post by:
Hello Experts!! I have an easy question when you allocate memory by using new you allocate memory dynamically but what is it called when you allocate memory without using new. Here is an...
5
by: Naveen Mukkelli | last post by:
Hi all, How can we use "NUnit" in socket programming. I mean, I'm writing a server program which accepts connection requests from the clients. I want to test the number of clients whenever a...
8
by: Hardy Wang | last post by:
Hi: Is it possible for me to create/open web application from remote machine other than port 80? And create application directly under virtual web site instead of creating a virtual directory?...
4
by: BM | last post by:
Hello, Ok, Im new to using ASP.NET and IIS so im not sure how or where to post this question but here goes: I am running IIS 5.1 on WinXP. I need to process http POST messages sent from...
3
by: David Hirschfield | last post by:
An xmlrpc client/server app I'm writing used to be super-simple, but now threading has gotten into the mix. On the server side, threads are used to process requests from a queue as they come in....
56
by: tasteless | last post by:
Hi guys, I need really hard questions (about 10) about PHP programming (some of elements OOP as well, but no MySQL questions - this is different part), this questions needs to be very hard, but...
18
by: subramanian100in | last post by:
Consider a class that has vector< pair<int, string>* c; as member data object. I need to use operator>to store values into this container object and operator<< to print the contents of the...
17
by: Suresh Pillai | last post by:
I am performing simulations on networks (graphs). I have a question on speed of execution (assuming very ample memory for now). I simplify the details of my simulation below, as the question I...
1
by: sandeepsangshetty | last post by:
Hi friends, I am new to Asp.net web pages using C#. I am doing "online written test"project using Asp.net. Here i'm storing the questions & answers in the sql sever 2005 database table. When the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.