新蛋科技.net工程方面的笔试题
1、 DataSet和DataReader的区别和相同点,分别适合用于什么样的情况?
答:
上海龙凤1314 shlf 2、 有基类如下:
上海龙凤1314 shlf public class parent
{
public parent()
{
Console.Write(“Parent”);
}
}
请写出一个子类Son,要求子类的构造函数实现如下的功能:(1)输出儿子的NAME、SEX、AGE、以及Parent,(2)要求在Son的'构造函数里不能有任何的命令语句出现,
新蛋科技.net工程方面的笔试题
。public class parent
{
public parent()
{
Console.Write(“Parent”);
}
}
上海龙凤1314 shlf public class Son:parent
上海龙凤1314 shlf { static string name=null;
static int sex=0;
static int age=0;
上海龙凤1314 shlf public parent(string name,int sex,int age):base()
{
name=name;
上海龙凤1314 shlf sex=sex;
age=age;
display();
}
publci void display()
{
上海龙凤1314 shlf Console.WriteLine(“name=”+name);
Console.WriteLine(“sex=”+sex);
上海龙凤1314 shlf Console.WriteLine(“age=”+age);
}
}
3、 请例举出三种以上进行页面重定向的方式(包括服务端和客户端)。
答: 第一种: Response.Redirect,
第二种: Server.Transfer
第三种:
上海龙凤1314 shlf function redirect(url) {
上海龙凤1314 shlf document.theForm.action = url;
document.theForm.submit();
}
第四种: StringBuilder sb=new StringBuilder();
上海龙凤1314 shlf sb.Append(“ ”);
Response.Write(sb.ToString());
上海龙凤1314 shlf 4、 写出禁用ViewState的语句。
上海龙凤1314 shlf 答: Control(具体的某个控件).EnableViewState=false;
上海龙凤1314 shlf 5、 请谈一谈.NET的code-behind模式和code_clude模式的区别,和各自的优点及缺点。
6、 写出下列七个程序段的输出结果:
(1)
interface InFace
{
void fun();
}
class MyParent:InFace
{
public void fun()
{
上海龙凤1314 shlf Console.WriteLine(“Parent”);
}
}
上海龙凤1314 shlf class MySon:MyParent
{
public void fun()
{
Console.WriteLine(“Son”);
}
}
上海龙凤1314 shlf public class MyTest
{
public static void Main(string[] args)
{
InFace inf=new MySon();
上海龙凤1314 shlf inf.fun();
}
}
结果:Parent
(2)
上海龙凤1314 shlf interface InFace
{
上海龙凤1314 shlf void fun();
}
class MyParent:InFace
{
上海龙凤1314 shlf public new void fun()
{
上海龙凤1314 shlf Console.WriteLine(“Parent”);
}
}
上海龙凤1314 shlf class MySon:MyParent
{
public void fun()
{
上海龙凤1314 shlf Console.WriteLine(“Son”);
}
}
public class MyTest
{
上海龙凤1314 shlf public static void Main(string[] args)
{
上海龙凤1314 shlf InFace inf=new MySon();
上海龙凤1314 shlf inf.fun();
Console.Read();
}
}
结果:Parent
(3)
上海龙凤1314 shlf interface InFace
{
void fun();
}
class MyParent:InFace
{
public new void fun()
{
Console.WriteLine(“Parent”);
}
}
class MySon:MyParent
{
public new void fun()
{
Console.WriteLine(“Son”);
}
}
public class MyTest
{
public static void Main(string[] args)
{
InFace inf=new MySon();
上海龙凤1314 shlf inf.fun();
Console.Read();
}
}
结果:Parent
(4)
interface InFace
{
上海龙凤1314 shlf void fun();
}
class MyParent:InFace
{
上海龙凤1314 shlf public void fun()
{
Console.WriteLine(“Parent”);
}
}
class MySon:MyParent
{
public override void fun()
{
上海龙凤1314 shlf Console.WriteLine(“Son”);
}
}
上海龙凤1314 shlf public class MyTest
{
上海龙凤1314 shlf public static void Main(string[] args)
{
InFace inf=new MySon();
上海龙凤1314 shlf inf.fun();
Console.Read();
}
}
结果:语法错误: 无法重写继承成员“ConsoleApplication6.MyParent.fun()”,因为它未标记为 virtual、abstract 或 override
【新蛋科技.net工程方面的笔试题】相关文章:
2.net笔试题