測試文檔
1. 一列數的規則如下: 1、1、2、3、5、8、13、21、34...... 求第30位數是多少, 用遞歸算法實現。public class MainClass
{
public static void Main()
{
Console.WriteLine(Foo(30));
}
public static int Foo(int i)
{
if (i <= 0)
return 0;
else if(i > 0 && i <= 2)
return 1;
else return Foo(i -1) + Foo(i - 2);
}
}
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
2. 請編程遍曆頁麵上所有TextBox控件並給它賦值為string.Empty?
foreach (System.Windows.Forms.Control control in this.Controls)
{
if (control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ;
tb.Text = String.Empty ;
}
}
3. 產生一個int數組,長度為100,並向其中隨機插入1-100,並且不能重複。
int[] intArr = new int[100];
ArrayList myList = new ArrayList();
Random rnd = new Random();
while (myList.Count < 100)
{
int num = rnd.Next(1, 101);
if (!myList.Contains(num))
myList.Add(num);
}
for (int i = 0; i <100; i++)
{
intArr[i] = (int)myList[i];
Console.Write("{0} ", intArr[i]);
Console.WriteLine();
}
4. sql:對一個有百萬行數據的表的某幾個字段進行模煳查詢,有幾種方式。
5. select * from user_info where user_name in ( select user_name from user) 怎麼提高這條語句的執行效率(可改寫sql語句的結構)。
6. 使用XML作為數據庫載體,自行設計XML結構。使用.Net三層架構設計思想。寫出對如下數據的讀,寫,修改
說明:節點1、節點2、節點3、節點4為根節點。節點5為節點1的第一個子節點,節點6為節點5的第一個子節點,節點七為節點5的第二個子節點,以此類推。
要求:
ü 新增節點時可根據選中的節點增加其子節點,也可新增根節點.
ü 修改時可修改節點名稱,節點所屬的父節點。
ü 刪除節點
注意:刪除節點時,如該節點有子節點,則需要將該節點的所有子節點的父節點改為被刪除節點的父節點(如刪除節點5,則節點6的ID改為0101,節點7的ID改為0103)
修改節點的父節點時,情況與刪除節點相同
|
名稱
|
|
節點1
|
|
節點2
|
|
節點3
|
|
節點4
|
|
節點5
|
|
節點6
|
|
節點7
|
|
節點8
|
|
節點9
|
最後更新:2017-04-02 00:06:38