13.C#中执行下列语句整形变量 x 和 y 的值是多少?(D )$ J/ \; \ S4 `8 c* l
int x=100;$ g6 a$ v, H% R; ]/ G3 H' o/ Q$ K
int y=++x; A x=100 y=100! L1 K& Y3 i7 O# `7 Y; Q
B x=101 y=100: p: e+ Y ? R7 a; K- A3 ~9 V
C x=100 y=101$ P P- Z. S$ c- r
D x=101 y=101
7 p& b3 m8 K; q( g$ [8 U/ I14.分析下列 Main 函数中的 if 语句.
$ I7 d2 H- ^- |' {+ D0 q5 _Class Class1{
# E6 U7 m, |# ^ c) M! SBool printInfo(){; M) d1 e% G6 X0 R" z8 `
System.Console.writeLine(“printInfo”);5 t S$ i1 R9 U) f4 D+ {
Return true* `: z$ E+ Q) N( j
}
' m2 O4 L" n5 ]2 V- e[STAThread]
1 O" P3 p* Q! I% I1 dStatic void Main(string[] args){
, ]4 H- r0 h% l; \, u& ~Class1 x = new Class1();2 R/ ?9 P# x0 ?: q/ S. G) N/ l& p
If(false && x.printInfo())
3 R- s, J% x. @7 }6 OSystem.console..writeline(“Main”)
+ q/ z) R9 I; F; u3 H//若为 If(false & x.printInfo()); n9 L# {8 k0 f, x
// System.console..writeline(“Main”)答案为 C! d. ^/ }7 b1 X2 O7 U
}
" T9 }4 B( A1 q" ?, b# P5 O}
' W; ]' g& K l0 Y" D L请问该程序在控制台的输出是什么?(A): W, S: z4 o7 O) i
A 无输出; m" i( m9 W+ J; V( e7 X9 o t
B Main
! z$ T$ q. l' T! w+ v1 DC PrintInto1 S: L7 k: q+ I2 Y# t5 z
D PrintInfo Main
1 J+ v4 e G9 h' O15.在 C#设计类时,如何将一个可读可写的公有属性 Name 修改为只读属性?(A B)
% M7 K1 l. h& D; h3 Y+ u. R! m5 D9 QA 将 Name 的 set 块删除
& Q5 w ]5 U2 [$ t/ A, p9 gB 将 Name 的 set 块删除
6 X1 E. b6 {1 mC 在 Namei 的 set 块前加修饰符 private( R O6 F5 V5 }/ N" [
D 在 Name 添加 readonly 修饰符 |