C # Review Questions

Source: Internet
Author: User

1. The following (D) is not the type of the method's parameter in C #.
A Value Type B. Reference Type C. Output Type D. Property
2. The data types in C # are classified as value types and reference types, and the following (B) are not reference types.
A Class B. Enumeration C. Interface D. Array
3. To declare a surrender:
public delegate int Mycallback (int x);
The method that can be used to refer to this commit is (D).
A void Mycallback (int x) B. int receive (int num) C. string receive (int x) D. Not sure
4. In the C # language, value types contain: simple types, struct types, and (C).
A Decimal Type B. Integer Type C. Enumeration Type D. Class type
5. Assuming a two-dimensional integer array of 10 rows and 20 columns, which of the following definition statements is correct (C).
A Int[]arr = new int[10,20]; B Int[]arr = int new[10,20];
C Int[,]arr = new int[10,20]; D Int[,]arr = new INT[20;10];
6. The following statements are not correct (B)
A A method is defined in Class A static void F (), and A1 is an object of a, then the reference to F is A.F ()
B Interfaces can include methods, properties, index indicators, events, constants, and fields.
C Interfaces are implemented through classes and structs.
D In. NET2005, declaring a class with partial keyword enables you to place a part of a class in a file, and
There is still a part to be put in a file.
7. The following (D) cannot be used as a class modifier in C #.
A Newb. Pubic, Privatec. Protected, Internald. Override
8. The following code snippet is available:
Class Class1
{
public static int Count = 0;
Public Class1 () {count++;}
}
Class1 O1 = new Class1 ();
Class1 O2 = new Class1 ();
Excuse me, the value of Class1.count is (B).
A 1 B. 2 C. 3 D. 4
9. There are 4 main types of reference: class type, array type, interface type, and (C).
A Object Type B. String Type C. Entrust Type D. Integer type
10. The class of the data type conversion is (C).
A Mod B. Const C. Convert D. Single
11. In C#.net, the object used to create the main menu is (C).
A Menub. Menuitemc. MENUSTRIPD. Item
12. In Vc#.net, a property that can identify a different object is (B).
A Textb. Namec. Indexd. Title
13. In the applications listed below, not a multi-document application is (C).
A Word B. Excel C. Notepad D. Powerpoint
14. In the members of the class, it is worth (C) to store the property.
A Property B. Method C. Field d. Event
15. In. NET, classification from the read and write characteristics of attributes can be divided into the following three types, except for (D).
A Read Only property B. Write only property C. Read-write attribute D. Non-readable non-writable properties
The ExecuteReader method of the 16.SqlCommand object returns one (B).
A XmlReader B. SqlDataReader C. SqlDataAdapter D. DataSet
6. When creating an access key, the symbol to be added before the letter in the menu title is (D)
a.! B #C. $ D. &
7. The event that is triggered when the window is loaded is (B)
A clickb. LOADC. GOTFOUCSD. DoubleClick
8. To change the window's caption, the window property to be changed is (A).
A Textb. Namec. Titled. Index
9. In the following attribute of the class, it is (C) that can be used to conveniently reuse existing code and data.
A Polymorphic B. Encapsulation C. Inherit d. Abstract
10. In NET Framework class Library, all classes related to the application of multithreaded mechanisms are placed in the (C) namespace.
A System.systhread B. System.thread C. System.Threading D. Netexception
11. An interface can include one and more members, and the following (D) cannot be included in the interface.
A Method, Property B. Index indicator C. Event d. Constants, Fields
12. The following (B) is not a C # keyword.
A Finallyb. IMPORTC. interfaced. SByte
13. Suppose there is a class A, a method is defined in Class A, static void f (); A1 is an object of a, the following call to F is correct for (A).
A A.F (); B A1.F (); C f (); D All wrong
14. The exception is handled by a try statement, and the following (B) processing is not the correct form.
A Try---catch (s) B. Try---throwc. Try---finallyd. Try---catch (s)---finally
15. The interface is implemented by (A).
A class or struct B. Attribute c. Method D. Event
1. (noun parsing) briefly describes the classification of data types in the C # language.
C # Data types are divided into three categories: value type, reference type, and pointer type. Value types contain simple types, struct classes
Type and enumeration types, where simple types are categorized into integer types, Boolean types, character types, floating-point types, and decimal classes
Type. Reference types include class types, interface types, trust types, and array types. Pointer types can only be used in unsafe mode.
2. (simple answer) (simplified noun) an object of ADO
1. Connection Object
In the ADO. NET object model, the Connection object is used to establish a connection to the specified data source. There are two common uses of the Connection object in the. Nets framework: One is OleDbConnection for most database connections, A SqlConnection that is dedicated to the connection to SQL Server. The primary property of the Connection object is ConnectionString, which is used to set the connection string, for example: myconn.connectionstring = "Persist Security info=false;integrated security=sspi;initialcatalog=northwind;server= (local) "Depending on the data source you are visiting, there are different Connection objects corresponding to them, and these Connection objects are naturally SqlConnection objects, OleDbConnection objects, OdbcConnection objects, and OracleConnection objects, you should select the appropriate Connection object based on the different access data sources.
2. Command Object
The command object is used to run commands for various operations on the data source, including operations such as retrieving, inserting, deleting, altering, and so on. You can use SQL statements, and you can use stored procedures to complete these operations. Depending on the data source you are visiting, there are different command objects corresponding to them, and these command objects are divided into
Not the SqlCommand object, the OleDbCommand object, the OdbcCommand object, and the OracleCommand object, you should select the corresponding Command object according to the different data sources. Suppose you want to use a stored procedure to manipulate a data source, you should set the CommandType property to StoredProcedure, and at the same time set the CommandText property to the name of the stored procedure. Assuming that the stored procedure uses a parameter, you can use the Parameters property of the Command object to access the input and output parameters and return values of the stored procedure.
3. DataReader Object
The DataReader object is used to read forward, read-only data streams from the data source, and is a simple data set that is usually faster than a dataset when it is used to read records. The DataReader object is created when the ExecuteReader method of the Command object retrieves data from the data source.
To obtain data from a DataReader object, you must combine the Read method of the DataReader object with the corresponding Get method. The Read method is used to move the record pointer to the next row of data, GetDateTime, getdouble, GetGuid, GetInt32, and so on, to get each column of information for the current row. These methods require that the name or index value of the column be used to determine which column of information is obtained. Depending on the. NET Framework data provider used, there are different DataReader objects corresponding to them. These DataReader objects are SqlDataReader objects, OleDbDataReader objects, OdbcDataReader objects, and OracleDataReader objects, respectively. The corresponding DataReader object should be selected based on the different access data sources. Note: You cannot use DataReader to alter the XU in the database, it is to read the database in a forward, read-only way.
4. DataAdapter Object
The DataAdapter object is used as a connector between a dataset and a data source to retrieve and save data. DataAdapter provides this connector by mapping Fill (which changes the data in the dataset to match the data in the data source) and update (which changes the data in the data source to match the data in the dataset), which is used to retrieve data from the data source and populate DataSet, you can also use it to resolve changes to the dataset back to the data source. DataAdapter enables the Connection object of the. NET Framework data Provider to connect to the data source and use the command object to retrieve data from the data source and resolve the changes back to the data source.
Depending on the. NET Framework data provider used, there are different DataAdapter objects corresponding to them. These DataAdapter objects are SqlDataAdapter objects, OleDbDataAdapter objects,
OdbcDataAdapter objects and OracleDataAdapter objects. The corresponding DataAdapter object should be selected based on the different access data sources.
5. DataSet Object
The DataSet object is the core object of a disconnected, distributed data scheme that supports ADO. A dataset is a memory-resident representation of data that, regardless of the data source, provides a consistent relational programming model that can be used to
A variety of different data sources, for XML data, or for managing data that is local to your application. The dataset represents the entire data set, including related tables, constraints, and relationships between tables, and can be thought of as an in-memory data Source Library.
3. (simple answer) what is overloading? What is the difference between override and overload?
Overloading refers to the inheritance down to the method, and again the design of its processing, for the future of the original processing way to cover the past. Override the method before the derived class is overridden, and the base class has a virtual decoration before the method with the same name. In this way, polymorphism can be achieved. Polymorphism refers to the coexistence of different methods with the same name in a program. There are two forms of polymorphism – overloading and rewriting.
4. (simple answer) the difference between a value type and a reference type.
Variables of value types themselves include their data, while variables of reference types include blocks of memory that refer to data
Refers to or is called a handle.
Value type variables are stored on the stack. Each program has its own stack at run time, and other programs cannot access it.
The reference type is stored in the heap. The reference type stores the address of the reference value of the actual data.
There are 4 types of reference in C # (class, delegate, array, interface)
5. (simple answer) classes and objects


6. (simple answer) socket programming idea

C # Review Questions

Related Article

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.