![]() |
Модераторы: Partizan, gambit |
![]() ![]() ![]() |
|
devdotnet |
|
|||
Новичок Профиль Группа: Участник Сообщений: 3 Регистрация: 30.11.2005 Репутация: нет Всего: нет |
Изучал С# по книжкам и там небыло тем раскрывающих ряд вопросов. Если кто может нормально(без измерения длины эго) ответить, то было бы здорово...
1) Which one of the following code samples creates a class that is passed by value? [Serializable] public class Weather {...} public class Weather : MarshalByVal {...} public class Weather : MarshalByValObject {...} [MarshalByVal] public class Weather {...} [CallContext(MarshalType.ByValue)] public class Weather {...} ---------------------------------------- 2) Which one of the following code samples is a representation of how the read/write string property "Name" is implemented as in MSIL? public string get_Name() {...}; public void set_Name(string value) {...} public void get_Name(out value) {...}; public void set_Name(string value) {...} public string GetName() {...}; public void SetName(string value) {...} public string Name() {...}; public void Name(string value) {...} ------------------------------------------- 3) In the above sample code, what happens if the DoPublish() method raises the event OnPublish and there are NO subscribers to the event? public class Publisher { public event EventHandler OnPublish; public void DoPublish() { OnPublish(this, null); } } Answer: An ApplicationException is raised. --------------------------------------------- 4) A named or positional parameter of an "Attribute" type can be which one of the following System.Type System.Sbyte System.UInt16 System.UInt64 System.Decimal --------------------------------------------- 5) Which one of the following code samples uses pre-processing directives to prevent a project from compiling when both the Release and Debug symbols are defined? #if Debug && Release #error A build can't be both debug and release #end if #if Debug && Release #throw A build can't be both debug and release #endif #if Debug & Release #throw A build can't be both debug and release #end if #if Debug && Release #error A build can't be both debug and release #endif #if Debug && Release #throw A build can't be both debug and release #end if -------------------------------- 6) Which one of the following code samples marks the method with the "STAThread" attribute? class CSharp { <Attribute:STAThread> public void Main(string[] args) {;} } class CSharp { [Attribute:STAThread] public void Main(string[] args) {;} } class CSharp { [Method:STAThread] public void Main(string[] args) {;} } class CSharp { [STAThread] public void Main(string[] args) {;} } class CSharp { <STAThread> public void Main(string[] args) {;} } Я думаю 3й вариант... ---------------------------------------- 7) Which one of the following describes the OO concept of Aggregation? знаю инкапсуляцию, наследование, полиморфизм. Что такое агрегация - не знаю... вот варианты ответов: A system of objects that are not related A system of objects that are built using each other A system of objects inherited from each other A system of objects that implement each other A system of objects that define each other ---------------------------------------------- 8) Which one of the following keywords causes a compile time error if used in a static method? lock continue fixed this using fixed- не знаю такого... lock - блокировка ресурса типа монитора должно работать нормально continue- без проблем this - без проблем using вообщето ставится в начале кода, до имлементации метода... может быть оно? ------------------------------------------------ 9) Which one of the following types of parameters is considered initially unassigned within a function member? ref out in, out byref in ------------------------------------------------ 10) Which one of the following code samples implements an indexer? class CSharp { public object CSharp[int idx] { get {...} set {...} } } class CSharp { public class Item[int idx] { get {...} set {...} } } class CSharp { public Item[int idx] { get {...} set {...} } } class CSharp { public object Item[int idx] { get {...} set {...} } } class CSharp { public object this[int idx] { get {...} set {...} } } -------------------------------------------------------- 11) What interface do you implement in order to provide a user of your class deterministic, destructor-like cleanup? ITerminate IAppDomainSetup IDestructor ILease IDisposable ---------------------------------------------------- 12) What implementation of the ternary operator rewrites the above code? if (a > b) c = 'a'; else { if (b == d) c = 'e'; else c = 'b'; } c = (b = d) ? 'e' : ((a > b) ? 'a' : 'b'); c = (b == d) ? 'e' : (a > b) ? 'a' : 'b'; c = (a > b) ? 'a' : (b = d) ? 'e' : 'b'; c = (a > b) ? 'a' : ((b = d) ? 'e' : 'b'); c = (a > b) ? 'a' : (b == d) ? 'e' : 'b'; --------------------------------------- 13) You are building a solution that processes requests from clients. Each request can be a complex process, taking time, so you have decided to implement this using asynchronous (or parallel) processing. What C# object provided by the .NET framework do you use to provide in-process methods for handling asynchronous processing in the above scenario? Delegate Class Thread AsyncProcess Parallel Думаю AsyncProcess... ----------------------------------------- 14) What C# keyword class access modifier specifies that the class is concrete and CANNOT be derived from? sealed final internal notinheritable abstract notinheritable ? ------------------------------------------- 15) Which one of the following is a valid implementation of the entry point "Main" method? public void Main(string[] args) {...} - не правильно public static void Main(int[] args) {...} -не правильно public static int Main(string[] args) {...} - будет работать если написать return 0; public static string Main() {...} public void Main() {...} -не првильно значит получается ответ public static int Main(string[] args) {...} - будет работать если написать return 0; ?? вообще, по умолчанию пишется static void Main(string[] args) -------------------------------- 16) What symbol do you use to indicate an XML comment on a line? #comment // /// #xml // <xml> не понятный вопрос...коментарии делаются двумя слешами в С... ------------------------------- 17) Destructors CANNOT be implemented in which one of the following? Types that inherit other types Types that can be inherited Heap allocated types Struct types User-defined reference types Struct types будет ответом?? -------------------------------------- 18) Which one of the following operators is overloadable? ** , & ?: [] ----------------------------------------- 19) Which one of the following is a limitation resulting from an a class that has an indexer property but does NOT implement the IEnumerator interface? The class cannot implement a GetEnumerator method. The "foreach" is not supported. The indexer must return an "object" type. Neither the "for" nor "foreach" statements is supported. The indexer can have only one parameter. -------------------------------------- 20) Given the above code sample, how do you use an instance of the Manager class polymorphically? public class Employee { protected double mySalary; public double Salary { get { return mySalary; } set { mySalary = value; } } public virtual double Earnings { get { return mySalary; } } } public sealed class Manager : Employee { private double myBonus; public double Bonus { get { return myBonus; } set { myBonus = value; } } public override double Earnings { get { return mySalary + myBonus; } } } варианты: Manager objManager = new Employee(); Employee objManager = new Employee(new Manager()); - думаю это Manager objManager = new Manager(); Employee objManager = new Employee(); Employee objManager = new Manager(); ----------------- 21) When a property is non-virtual and contains only a small amount of code, the execution environment may replace calls to accessors with the actual code of the accessor. Which one of the following is the term for the process described above? interning JIT inlining pinning PreJIT -------------------- 22) public class CLSCompliant { private uint MethodA() {} private string MethodB() {} protected long MethodC() {} protected unsafe string MethodD() {} - looks like this one protected static long MethodE() {} } What method in the sample code above is NOT CLS-Compliant? |
|||
|
||||
Exception |
|
|||
Эксперт ![]() ![]() ![]() ![]() Профиль Группа: Участник Клуба Сообщений: 4525 Регистрация: 26.12.2004 Репутация: 29 Всего: 186 |
1. Один топик - один вопрос.
2. Вопросы простые, если ты знаешь С#, должен легко на них ответить. 3. Форум не создан для того, чтобы просить 'умных дядек' написать программу, курсовую или дать ответы на тест. Конкретный вопрос - конкретный ответ. Что конкетно непонятно? |
|||
|
||||
HalkaR |
|
|||
![]() Пуфыстый назгул ![]() ![]() ![]() ![]() Профиль Группа: Экс. модератор Сообщений: 2132 Регистрация: 8.12.2002 Где: В Москве Репутация: 14 Всего: 42 |
BrainBench напоминает.
|
|||
|
||||
sergejzr |
|
|||
![]() Un salsero ![]() Профиль Группа: Админ Сообщений: 13285 Регистрация: 10.2.2004 Где: Германия г .Ганновер Репутация: нет Всего: 360 |
Модератор: Пожалуйста, один топик - один вопрос.
Модератор: Название темы должно отражать ее суть! Вопросы в соответсвующие разделы! Просьбы по решению задачек в "Центр помощи"! Эта тема вообще ни одному правилу не соответсвует посему - закрыта! Удалять пока не буду, чтобы дать Вам возможность прочитать это и создать темы по правилам ![]() |
|||
|
||||
![]() ![]() ![]() |
Прежде чем создать тему, посмотрите сюда: | |
|
Используйте теги [code=csharp][/code] для подсветки кода. Используйтe чекбокс "транслит" если у Вас нет русских шрифтов. Что делать если Вам помогли, но отблагодарить помощника плюсом в репутацию Вы не можете(не хватает сообщений)? Пишите сюда, или отправляйте репорт. Поставим :) Так же не забывайте отмечать свой вопрос решенным, если он таковым является :) Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, mr.DUDA, THandle. |
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) | |
0 Пользователей: | |
« Предыдущая тема | Общие вопросы по .NET и C# | Следующая тема » |
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |