当前位置:文档之家› 东南大学08级C++(下)上机试卷和答案解析

东南大学08级C++(下)上机试卷和答案解析

东南大学08级C++(下)上机试卷和答案解析
东南大学08级C++(下)上机试卷和答案解析

东南大学08级C++(下)上机试卷D和答案解析

(考试时间80分钟卷面成绩100分)

学号姓名机位号

说明:首先在Z盘建立一个以自己的学号命名的文件夹,用于存放上交的*.CPP 文件,考试结束前根据机房要求,将这个文件夹传送到网络服务器上,注意:提交时只保留文件夹中的CPP文件。

一、改错题(50分)

【要求】调试程序,修改其中的语法错误及少量逻辑错误。只能修改、不能增加或删除整条语句,但可增加少量说明语句和编译预处理指令。

【注意】源程序以“学号f1.cpp”命名,存入自己学号文件夹。

【题目】以下程序实现动态生成数据成员,析构函数用来释放动态分配的内存,复制构造函数和复制赋值操作操作符实现深复制。

【含错误的源程序】

#include

#include

using namespace std;

class student

{

char *pName;

public:

student( );

student( char *pname, int len ); //错误1

student( student &s );

~student( );

student & operator = ( student &s );

} //错误2

student::student( )

{

cout >> "Constructor"; //错误3

pName = NULL;

cout << "默认" << endl;

}

student::student( char *pname )

{

cout << "Constructor";

pName = new char[strlen(pname)+1];

if ( pName ) strcpy( pName, pname );

cout << pName << endl;

}

student::student( student s ) //错误4

{

cout<<"Copy Constructor";

if( s.pName )

{ int len = strlen(s.pName);

pName = new char(len+1); //错误5

if ( pName ) strcpy( pName, s.pName );

cout << pName << endl;

}

else pName = NULL;

}

student::~student()

{

cout << "Destructor";

if ( pName ) cout << pName << endl;

delete PName; //错误6

}

student & Student::operator = ( student &s ) //错误7 {

cout << "Copy Assign operator";

delete[] pName;

if(s.pName)

{

len = strlen(s.pName); //错误8

pName = new char[len]; //错误9

if( pName ) strcpy( pName, s.pName );

cout << pName << endl;

}

else pName=NULL;

return *this;

}

int main(void)

{

student s1("范英明"), s2("沈俊");

student s3(s1);

student *s4 = new student(s2);

delete s3; //错误10

return 0;

}

二、编程题(50分)

【注意】源程序以“学号f2.cpp”命名,存入自己学号文件夹。

【题目】

给产品销售价定价,请编写产品类Product。确定产品的销售价的公式为:

产品销售价= 原材料价格*1.5 + 加工费*2.0

要求:

类Product的数据成员包括ProductName(表示产品名称,为字符串型)、MatName (表示原材料名,为字符串型)、MatPrice0(表示原材料进价,为整型)、ServicePrice (表示加工费,为整型)、SalePrice(表示商品销售价,为整型)。

类Product的构造函数实现从文本文件Product.txt中读取产品名称、原材料名、原材料进价和加工费。

类Product的成员函数CalSalePrice()计算产品的销售价格。

类Product的析构函数将完整的产品信息写入文本文件Output.txt。写入的信息包括产品名称、原材料名称、原材料价格、加工费、产品销售价。

【注意】将源程序以文件名“学号f2.cpp”存入Z盘自己的文件夹中。

#include

#include

#include

using namespace std;

class Product

{

string ProductName; //产品名称

string MatName; // 原材料名称

int MatPrice0; // 原材料进价

int ServicePrice; //加工费

int SalePrice; //最终定价

public:

Product();

~Product();

void CalSalePrice();

};

Product::Product()

{

//类Product的构造函数实现从文本文件Product.txt中读取产品名称、原材料名称、原材料进价、加工费。

}

Product::~Product()

{ //此处添加代码

//类Product的析构函数将完整的产品信息写入文本文件Output.txt

}

void Product::CalSalePrice()

{

//类Product的成员函数CalSalePrice()计算产品的销售价格。

}

用于测试的main函数如下:

int main()

{

Product pro;

pro.CalSalePrice();

return 0;

}

【提醒】上传的学号文件夹中只需包含f1.cpp、f2.cpp及Output.txt三个文件即可,其余文件上传前尽可删除。

答案解析

一.改错题

#include

#include

using namespace std;

class student

{

char *pName;

public:

student();

student( char *pname);

student( student &s );

~student( );

student & operator = ( student &s );

} ;

student::student( )

{

cout << "Constructor";

pName = NULL;

cout << "默认" << endl;

}

student::student( char *pname )

{

cout << "Constructor";

pName = new char[strlen(pname)+1];

if ( pName ) strcpy( pName, pname );

cout << pName << endl;

}

student::student( student & s )

{

cout<<"Copy Constructor";

if( s.pName )

{ int len = strlen(s.pName);

pName = new char[len+1];

if ( pName ) strcpy( pName, s.pName );

cout << pName << endl;

}

else pName = NULL;

}

student::~student()

{

cout << "Destructor";

if ( pName ) cout << pName << endl;

delete[] pName;

}

student & student::operator = ( student &s )

{

cout << "Copy Assign operator";

delete[] pName;

if(s.pName)

{

int len = strlen(s.pName);

pName = new char[len+1];

if( pName ) strcpy( pName, s.pName );

cout << pName << endl;

}

else pName=NULL;

return *this;

}

int main(void)

{

student s1("范英明"), s2("沈俊");

student s3(s1);

student *s4 = new student(s2);

return 0;

}

二.编程题

#include

#include

#include

#include

using namespace std;

class Product

{

string ProductName; //产品名称

string MatName; // 原材料名称

int MatPrice0; // 原材料进价

int ServicePrice; //加工费

int SalePrice; //最终定价

public:

Product();

~Product();

void CalSalePrice();

};

Product::Product()

{

fstream datafile("d:\\Product.txt",ios::in); //类Product的构造函数实现从文本文件Product.txt中读取产品名称、原材料名称、原材料进价、加工费。

if(!datafile)

{

cout<<"open error";

}

if(!datafile==0)

{

string productName; //产品名称

string matName; // 原材料名称

int matPrice0; // 原材料进价

int servicePrice; //加工费

if(!datafile.eof())

{

datafile>>productName>>matName>>matPrice0>>servicePrice;

ProductName=productName;

MatName=matName;

MatPrice0=matPrice0;

ServicePrice=servicePrice;

}

}

}

Product::~Product()

{

fstream datafile("d:\\Product.txt",ios::out) ;

datafile<

datafile<

}

void Product::CalSalePrice()

{

//产品销售价= 原材料价格*1.5 + 加工费*2.0

//类Product的成员函数CalSalePrice()计算产品的销售价格。

SalePrice=MatPrice0*1.5+ServicePrice*2.0;

}

int main()

{

Product pro;

pro.CalSalePrice();

return 0;

}

最新东南大学微机试卷-期末-AB

东南大学考试卷 考试科目微机系统与接口考试形式闭卷试卷类型 B卷 考试时间长度120分钟共 5 页得分 一、填空或选择填空(35分) 1. 8086/8088段寄存器的功能是_____________, 某一时刻程序最多可以指定访问________个存储段。 A1.用于计算有效地址B1. 用于存放段起始地址及计算物理地址 C1.分段兼容8080/8085指令D1. 方便分段执行各种数据传送操作 A2. 3 B2. 4 C2. 6D2. 64K E2.初始化时程序指定 2.8086/8088系统中复位信号RESET的作用是使_______ A. 处理器总线休眠 B.处理器总线清零 C. 处理器和协处理器工作同步 D. MPU恢复到机器的起始状态并重新启动 3. 在默认情况下, ADD [DI+100], DI指令中目标操作数存放在______寄存器指定的存储段中,指令执行时将完成______ 个总线操作周期。 A1. CS B1. DS C1. ES D1. SS A2. 0 B2. 1 C2. 2 D2. 3 4. 8086/8088CPU用指令ADD对两个8位二进制数进行加法运算后,结果为14H,且标志位CF=1,OF=1,SF=0,此结果对应的十进制无符号数应为_____ A. 20 B. –20 C. –236 D.276 5.堆栈是内存中的一个专用区域,其一般存取规则是_________ A.先入先出(FIFO) B.先入后出(FILO) C.按字节顺序访问 D.只能利用PUSH/POP指令读写 6. 在下列指令中,使堆栈指针变化8字节的指令是_____. A. PUSHA B. CALL 4000:0008H C. RET 8 D.SUB SP,8

C语言上机报告答案

2010C语言实验报告参考答案 实验一熟悉C语言程序开发环境及数据描述 四、程序清单 1.编写程序实现在屏幕上显示以下结果: The dress is long The shoes are big The trousers are black 答案: #include main() { printf("The dress is long\n"); printf("The shoes are big\n"); printf("The trousers are black\n"); } 2.改错题(将正确程序写在指定位置) 正确的程序为: #include main() { printf("商品名称价格\n"); printf("TCL电视机¥7600\n"); printf("美的空调¥2000\n"); printf("SunRose键盘¥50.5\n"); } 2.编写程序: a=150,b=20,c=45,编写求a/b、a/c(商)和a%b、a%c(余数)的程序。答案: #include main() { int a,b,c,x,y; a=150; b=20; c=45; x=a/b; y=a/c; printf("a/b的商=%d\n",x); printf("a/c的商=%d\n",y);

x=a%b; y=a%c; printf("a/b的余数=%d\n",x); printf("a/c的余数=%d\n",y); } 4. 设变量a的值为0,b的值为-10,编写程序:当a>b时,将b赋给c;当a<=b时,将a 赋给c。(提示:用条件运算符) 答案: #include main() { int a,b,c; a=0; b=-10; c= (a>b) ? b:a; printf("c = %d\n",c); } 五、调试和测试结果 1.编译、连接无错,运行后屏幕上显示以下结果: The dress is long The shoes are big The trousers are black 3、编译、连接无错,运行后屏幕上显示以下结果: a/b的商=7 a/c的商=3 a/b的余数=10 a/c的余数=15 4. 编译、连接无错,运行后屏幕上显示以下结果: c =-10 实验二顺序结构程序设计 四、程序清单 1.键盘输入与屏幕输出练习 问题1 D 。 问题2 改printf("%c,%c,%d\n",a,b,c);这条语句 改成:printf("%c %c %d\n",a,b,c);

东南大学编译原理试题

东南大学一九九三年攻读硕士学位研究生入学考试试题 试题编号:553 试题名称:编译原理 一:(15分)判断下列命题的真假,并简述理由: 1.文法G的一个句子对应于多个推导,则G是二义的. 2.LL(1)分析必须对原有文法提取左因子和消除左递归. 3.算符优先分析法采用"移近-归约"技术,其归约过程是规范的. 4.文法S→aA;A→Ab;A→b是LR(0)文法(S为文法的开始符号). 5.一个BASIC解释程序和编译程序的不同在于,解释程序由语法制导翻译成目标代码并立即执行之,而编译程序需产生中间代码及优化. 二:(15分)设计一个最小状态有穷自动机,识别由下列子串组成的任意字符串. GO,GOTO,TOO,ON 例如:GOTOONGOTOOGOON是合法字符串. 三:(15分)构造一个LL(1)文法G,识别语言L: L={ω|ω为{0,1}上不包括两个相邻的1的非空串} 并证明你的结论. 四:(20分)设有一台单累加器计算机,并汇编语言含有通常的汇编指令LOAD,STORE,ADD和MUL. 1.写一个递归下降分析程序,将如下文法所定义的赋值语句翻译成汇编语言: A→i:=E E→E+E|E*E|(E)|i 2.利用加,乘法满足交换率这一性质,改进你的分析程序,以期产生比较高效的目标代码. 五:(15分)C为大家熟知的程序语言. 1.C的参数传递采用传值的方式,而且允许函数定义和调用时的参数个数不一致(如printf).请指出其函数调用语句: f(arg1,arg2,...,argn) 翻译成的中间代码序列,并简述其含义. 2.C语言中的变量具有不同的作用范围,试述C应采用的存储分配策略. 六:(20分)设有一个子程序的四元式序列为: (1) I:=1 (2) if I>20 GOTO (16) (3) T1:=2*J (4) T2:=20*I (5) T3:=T1+T2 (6) T4:=addr(A)-22 (7) T5:=2*I (8) T6:=T5*20 (9) T7:=2*J (10) T8:=T6+T7 (11) T9:=addr(A)-22 (12) T10:=T9[T8] (13) T4[T3]:=T10+J

东南大学信号与系统试题含答案

东 南 大 学 考 试 卷(A 、B 卷) (答案附后) 课程名称 信号与线性系统 考试学期 03-04-3 得分 适用专业 四系,十一系 考试形式 闭卷 考试时间长度 120分钟 一、简单计算题(每题8分): 1、 已知某连续信号()f t 的傅里叶变换为 21 ()23F j j ωωω= -+,按照取 样间隔1T =对其进行取样得到离散时间序列()f k ,序列()f k 的Z 变换。 2、 求序列{} 10()1,2,1 k f k ==和2()1cos ()2f k k k πε????=+ ???????的卷积和。 3、 已知某双边序列的Z 变换为 21 ()1092F z z z = ++,求该序列的时域表 达式()f k 。

4、 已知某连续系统的特征多项式为: 269111063)(234567+++++++=s s s s s s s s D 试判断该系统的稳定情况,并指出系统含有负实部、零实部和正实部的根各有几个? 5、 已知某连续时间系统的系统函数为: 323 2642 ()21s s s H s s s s +++=+++。试给出该系统的状态方程。 6、 求出下面框图所示离散时间系统的系统函数。 ) (k

二、(12分)已知系统框图如图(a ),输入信号e(t)的时域波形如图(b ),子系统h(t)的冲激响应波形如图(c)所示,信号()f t 的频谱为 ()jn n F j e πω ω+∞ =-∞ = ∑ 。 图(a) y(t) ) (t f e(t)图(b) h(t)图(c) 试:1) 分别画出)(t f 的频谱图和时域波形; 2) 求输出响应y(t)并画出时域波形。 3) 子系统h(t)是否是物理可实现的?为什么?请叙述理由;

东南大学编译原理词法分析器实验报告

词法分析设计 1. 实验目的 通过本实验的编程实践,了解词法分析的任务,掌握词法分析程序设计的原理和构造方法,对编译的基本概念、原理和方法有完整的和清楚的理解,并能正确地、熟练地运用。 2. 实验内容 用C++语言实现对C++语言子集的源程序进行词法分析。通过输入源程序从左到右对字符串进行扫描和分解,依次输出各个单词的内部编码及单词符号自身值;若遇到错误则显示“Error”,然后跳过错误部分继续显示;同时进行标识符登记符号表的管理。 3. 实验原理 本次实验采用NFA->DFA->DFA0的过程: 对待分析的简单的词法(关键词/id/num/运算符/空白符等)先分别建立自己的FA,然后将他们用产生式连接起来并设置一个唯一的开始符,终结符不合并。 待分析的简单的词法 (1)关键字: "asm","auto","bool","break","case","catch","char","class","

const","const_cast"等 (2)界符(查表) ";",",","(",")","[","]","{","}" (3)运算符 "*","/","%","+","-","<<","=",">>","&","^","|","++","--"," +=","-=","*=","/=","%=","&=","^=","|=" relop: (4)其他单词是标识符(ID)和整型常数(SUM),通过正规式定义。 id/keywords: digit: (5)空格有空白、制表符和换行符组成。空格一般用来分隔ID、SUM、运算符、界符和关键字,词法分析阶段通常被忽略。

东南大学通信原理试卷及参考答案

东南大学考试卷( A 卷)课程名称通信原理考试学期04-05-3 得分 适用专业考试形式闭卷考试时间长度 150分钟 Section A(30%): True or False (Give your reason if False,2% for each question) 1. A typical mobile radio channel is a free propagation, linear, and time invariant channel. ( ) 2.The power spectral density of a stationary process is always nonnegative. ( ) 3.In a communication system, noise is unwanted and over which we have incomplete control. ( ) 4.If a random process is stationary, it is ergodic; if a Gaussian random process is stationary, then it is also strictly stationary. ( ) 5.Double Sideband-Suppressed Carrier (DSB-SC), Single Sideband (SSB), and Frequency Modulation (FM) are all linear modulation schemes. ( ) 6.Figure of merit (defined as (SNR)O/(SNR)C) of AM of DSB-SC is 1/3, and figure of merit of Amplitude Modulation (AM) is less than or equal to 1/3. ( ) 7. -law is a nonlinear compression law and A-law is a linear compression law. ( ) 8.The matched filter at the receiver maximizes the peak pulse signal-to-noise ratio, thus is optimal in a baseband data transmission system with Inter-Symbol Interference (ISI). ( ) 9.Correlative-level coding (also known as partial-response signaling) schemes are used to avoid ISI. ( ) 10.Time-Division Multiplexing (TDM) is used in Asymmetric Digital Subscriber Lines (ADSL) to separate voice signals and data transmission. ( ) 11.If coefficients of an equalizer is adjusted using the Least-Mean-Square (LMS) algorithm adaptively, then the matched filter in front of the equalizer is not necessary. ( ) 12.In an M-ary Phase-Shift Keying (M-PSK) system, if the average probability of symbol error is P e, then the average Bit Error Rate (BER) of the system is P e/log2M. ( ) 13.With the same Signal-to-Noise Ratio (SNR), 16-ary Quadrature Amplitude Modulation (16-QAM) has better performance than 16-ary Phase-Shift Keying (16-PSK). The reason is that 16-QAM has constant envelop. ( ) 14.With the same SNR, Minimum Shift Keying (MSK) has better performance than Sunde’s Frequency-Shift Keying (FSK). They are both Continuous-Phase Frequency-Shift Keying (CPFSK). ( ) 15.If the largest frequency component of an band-limited signal X(t) is at 100 Hz, then the corresponding Nyquist rate is 200 Hz. ( ) 共 5 页第1 页

C语言上机练习题

上机练习题 完成 1.输入一个不超过五位的正整数,输出其逆数。例如输入12345,输出应为54321。 完成 2.计算1+2+3…+n的值,n是从键盘输入的自然数。 完成 3.从终端(键盘)读入20个数据到数组中,统计其中正数的个数,并计算这些正数之和。完成 4.从终端(键盘)将5个整数输入到数组a中,然后将a逆序复制到数组b中,并输出b中 各元素的值。 完成 5.要将五张100元的大钞票,换成等值的50元,20元,10元,5元一张的小钞票,每种面 值至少1张,编程输出所有可能的换法,程序应适当考虑减少重复次数。 完成 6.求n以内(不包括n)同时能被3和7整除的所有自然数之和的平方根s,n从键盘输入。 例如若n为1000时,函数值应为:s=153.909064。 完成 7.一辆卡车违反交通规则,撞人后逃跑。现场有三人目击事件,但都没有记住车号,只记下 车号的一些特征。甲说:牌照的前两位数字是相同的;乙说:牌照的后两位数字是相同的,但与前两位不同;丙是数学家,他说:四位的车号刚好是一个整数的平方。请根据以上线索找出车号。 完成 8.输入1~10之间的一个数字,输出它对应的英文单词。 完成 9.个位数为6且能被3整除但不能被5整除的三位自然数共有多少个,分别是哪些? 完成 10.用自然语言描述程序逻辑如下,试写程序。 ①设置环境; ②定义变量i、j、s,以及用于放置结果的变量sum,并令sum初值为0; ③i=1; ④如果i≤100,则转⑤,否则转⑧; ⑤令s=0,求前i个自然数之和,并放于变量s之中; ⑥sum=sum+s; ⑦i增加1,转④; ⑧输出和sum,结束。 完成 11.用自然语言描述的程序逻辑为: ①设置环境; ②定义变量i、flag和password,并令flag=0,i=0; ③用户回答口令,将其赋于password变量; ④口令正确?如果是,则flag=1,转⑥。否则转⑤; ⑤回答三次口令了吗?如果没有,计数器加1后(i++),转③,否则转⑥; ⑥根据flag之值输出相应信息。 12.用自然语言描述的程序逻辑如下: ①设置环境;

东南大学数字通信试卷(附答案)

东南大学考试卷(A卷) 课程名称 数 字 通 信 考试学期 04-05-2得分 适用专业无线电工程系 考试形式闭 卷 考试时间长度120分钟共 页 Section A:True or False (15%) 1. 1.When the period is exactly 2m, the PN sequence is called a maximal-length-sequence or simply m-sequence. 2. 2.For a period of the maximal-length sequence, the autocorrelation function is similar to that of a random binary wave. 3. 3.For slow-frequency hopping,symbol rate R s of MFSK signal is an integer multiple of the hop rate R h. That is, the carrier frequency will change or hop several times during the transmission of one symbol. 4. 4.Frequency diversity can be done by choosing a frequency spacing equal to or less than the coherence bandwidth of the channel. 5. 5.The mutual information of a channel therefore depends not only on the channel but also on the way in which the channel used. 6. 6.Shannon’s second theorem specifies the channel capacity C as a fundamental limit on the rate at which the transmission of reliable error-free messages can take place over a discrete memoryless channel and how to construct a good code. 7.7.The syndrome depends not only on the error pattern, but also on the transmitted code word. 8.8.Any pair of primitive polynomials of degree m whose corresponding shift registers generate m-sequences of period 2m-1 can be used to generate a Gold sequence. 9.9.Any source code satisfies the Kraft-McMillan inequality can be a prefix code. 10.10.Let a discrete memoryless source with an alphabet ? have entropy H? and produce symbols once every s T seconds. Let a discrete () memoryless channel have capacity and be used once every C c T

C语言上机实验标准答案.doc

实验一上机操作初步 (2 学时 ) 一、实验方式:一人一机 二、实验目的: 1、熟悉 VC++语言的上机环境及上机操作过程。 2、了解如何编辑、编译、连接和运行一个 C 程序。 3、初步了解 C程序的特点。 三、实验内容: 说明:前三题为必做题目,后两题为选做题目。 1、输出入下信息: ( 实验指导书 P79) ************************* Very Good ************************* 2、计算两个整数的和与积。( 实验指导书 P81) 3、从键盘输入一个角度的弧度值x,计算该角度的余弦值,将计算结果输出到屏幕。 ( 书 P3) 4、在屏幕上显示一个文字菜单模样的图案: ================================= 1 输入数据 2 修改数据 3 查询数据 4 打印数据 ================================= 5、从键盘上输入两个整数,交换这两个整数。 四、实验步骤与过程: 五、实验调试记录: 六、参考答案: 1、#include <> void main( ) {printf( printf( printf( “ ********************\n “Very Good\n” ); “ ********************\n ” ); ” ); } 2、#include <> void main( ) {int a,b,c,d; printf( “ Please enter a,b: ”);

scanf( “%d,%d” ,&a,&b); c=a+b; d=a*b; printf( “ %d+%d=%d\n” ,a,b,c); printf( “ %d*%d=%d\n” ,a,b,d); } 3、#include <> #include <> void main( ) { double x,s; printf( “ Please input value of x: ”); scanf( “%lf ” ,&x); s=cos(x); printf( “ cos(%lf)=%lf\n ”,x,s); } 4、#include <> void main( ) { printf( “ ==================================\n”); printf( “ 1 输入数据 2 修改数据 \n ”); printf( “ 3 查询数据 4 打印数据 \n ”); printf( “ ===================================\n”); } 5、#include <> void main( ) { int x,y,t; printf( “ Please enter x and y: ”); scanf( “%d%d”,&x,&y); t=x; x=y; y=t; printf( “ After swap:x=%d,y=%d\n ” ,x,y); } 实验二简单的 C程序设计 (4 学时 ) 一、实验方式:一人一机 二、实验目的: 1、掌握 C语言的数据类型。 2、学会使用 C语言的运算符及表达式。 3、掌握不同数据类型的输入输出方法。 三、实验内容: 说明:前四题为必做题目,后两题为选做题目。

c语言上机练习题及答案[1]汇总

1.从矩形的长,宽,输出面积(长为 6.5,宽为4.5 ) #in elude mai n() float len gth,width,area; sca nf("%f%f", & le ngth,&width); area=le ngth*width; prin tf("area=%f\n",area); 2.定义符号常量,从键盘输入圆的半径 3.5,求圆的周长和面积 #defi ne PI 3.14 #in clude mai n() float r,c,area; sca nf("%f",&r); c=2* Pl*r; area=P l*r*r; prin tf("c=%f,area=%f\n",c,area); 3.练习上机手册P10 3,4, 5题,看看输出结果,并思考为什么 4.从键盘输入一个整数,输出其绝对值(采用两个if语句实现)int i; sea nf("%d",&i); if(i>=0) prin tf("i=%d\n",i); if(i<0) prin tf("i=%d\n",-i); 5.从键盘输入一个整数,输出其绝对值(采用if ―― else语句实现)#in elude mai n() int i; #in clude mai n()

sca nf("%d",&i); if(i>=0) prin tf("i=%d\n",i); else prin tf("i=%d\n",-i); 6.从键盘输入年份,判断是不是闰年,如果是,输出是闰年(上机考试重点) #in elude mai n()

东南大学电子技术基础模拟部分试卷 答案

一、填空题(20分,每空1分) 1.双极型三极管是 控制器件,当其工作在放大区时发射结需要加 偏置,集电结需要加 偏置。场效应管是 控制器件。 2. 在有源滤波器中,运算放大器工作在 区;在滞回比较器中,运算放大器工 作在 区。 3. 在三极管多级放大电路中,已知A u1=20,A u2=-10,A u3=1,则可知其接法分别为: A u1是 放大器,A u2是 放大器,A u3是 放大器。 4. 在双端输入、单端输出的差动放大电路中,发射极R e 公共电阻对 信号的 放大作用无影响,对 信号具有抑制作用。差动放大器的共模抑制比K CMR = 。 5. 设某一阶有源滤波电路的电压放大倍数为 2001200 f j A += ,则此滤波器为 滤波器,其通带放大倍数为 ,截止频率为 。 6. 如图所示的功率放大电路处于 类工作状态;其静态损耗为 ;电路的 最大输出功率为 ;每个晶体管的管耗为最大输出功率的 倍。 二、基本题:(每题5分,共25分) 1.如图所示电路中D 为理想元件,已知u i = 5sin ωt V ,试对应u i 画出u o 的波形图。 2.测得电路中NPN 型硅管的各级电位如图所示。试分析管子的工作状态(截止、饱和、放 大)。 3. 已知BJT 管子两个电极的电流如图所示。求另一电极的电流,说明管子的类型(NPN 或PNP )并在圆圈中画出管子。 4.如图所示电路中,反馈元件R 7构成级间负反馈,其组态为 ; 其作用是使输入电阻 、放大电路的通频带变 。 三、如图所示电路中,β=100,Ω='100b b r ,试计算:(15分) 1.放大电路的静态工作点;(6分) 2.画出放大电路的微变等效电路;(3分) 3.求电压放大倍数A u 、输入电阻R i 和输出电阻R o ;(6分) 四、判断如图所示电路中引入了何种反馈,并在深度负反馈条件下计算闭环放大倍数。 (9分) 五、电路如图所示。试用相位条件判断下面的电路能否振荡,将不能振荡的电路加以改正。 (6分) 六、用理想运放组成的电压比较器如图所示。已知稳压管的正向导通压降U D =0.7V ,U Z = 5V 。 1.试求比较器的电压传输特性; 2.若u i =6sin ωt V ,U R 为方波如图所示,试画出u o 的波形。 (10分) 七、理想运放电路如图所示,设电位器动臂到地的电阻为KR W ,0≤K ≤1。试求该电路电压 增益的调节范围。 (10分) 八、一串联型稳压电路如图所示。已知误差放大器的A u >>1,稳压管的U z =6V ,负载R L =20Ω。 1.试标出误差放大器的同相、反相端; 2.说明电路由哪几部分组成? 3.求U o 的调整范围; (10分) 参考答案 一、 1.电流、正向、反向;电压。 2.线性、非线性。

东南大学编译原理试卷

S o ut he a s t Uni v e r si ty E xa mi na ti o n P a per (i n-t e r m) Course Name Principles of Compiling Examination Term Score Related Major Computer & Software Examination Form Close test Test Duration120 Mins There are 5 problems in this paper. Y ou can write the answers in English or Chinese on the attached paper sheets. 1.Please construct context-free grammars with ε-free productions for the following languages (20%). (1){i|i∈N(Natural number), and i is a palindrome, and (i mod 5)=0} (2){ω| ω∈(a,b,c,d)* and the numbers of a’s ,b’s and c’s occurred in ω are even, and ωstarts with a or c , ends with d } 2.Please construct a DFA with minimum states for the following regular expression. (20%) (((a|b)*a)*(a|b))*(a|b) 3.Please eliminate the left recursions (if there are)and extract maximum common left factors (if there are) from the following context free grammar, and then decide the resulted grammar is whether a LL(1) grammar by constructing the related LL(1) parsing table.(20%) Please obey the rules of examination. If you violate the rules, your answer sheets will be invalid 共 2 页第 1 页

C语言上机题库

C语言习题集 3.11输入'A'~'F'中的一个字母,代表一个十六进制数,将其转换为十进制数,求该数与15的和并输出。 输入格式: B 输出格式: 26 #include int main(void) { char ch; int sum; ch=getchar(); sum=ch-'A'+10+15; printf("%d\n",sum); return 0; } 3.12输入三个整数,求其平均值。 输入格式: 3 5 7 输出格式: 5 #include int main(void) { int a,b,c,aver; scanf("%d %d %d",&a,&b,&c); aver=(a+b+c)/3; printf("%d\n",aver); return 0; } 3.13根据c=5/9*(f-32) 公式,输入华氏温度f,求摄氏温度c,结果精确到小数点后两位。 输入格式: 80.0 输出格式: 26.67 #include int main(void) { float f,c; scanf("%f",&f); c=5.0/9*(f-32); printf("%.2f\n",c); return 0; } 3.14输入一个四位正整数,求其各位数字之和。例如,1357的各位数字之和为1 + 3 + 5 + 7 = 16。 输入格式: 1357 输出格式: 16 #include int main(void) { int num; int a,b,c,d,total; scanf("%d",&num); a=num/1000; b=(num-a*1000)/100; c=(num-a*1000-b*100)/10; d=num-a*1000-b*100-c*10; total=a+b+c+d; printf("%d\n",total); return 0; } 3.15输入一大写字母,输出对应的小写字母。 输入格式: A 输出格式: a #include int main(void) { char c1,c2;

东南大学《工程矩阵理论》试卷样卷及答案

工程矩阵理论试卷 一、假如n n A C ?∈。 1、记} { ()n n V A X C AX XA ?===。证明:()V A 是n n C ?的子空间。 2、若A 是单位矩阵,求()V A 。 3、若2n =,0011A ?? = ?-?? 。求这里V (A )的一组基及其维数。 4、假如} { 22 ()W A X C AX O ?===。问:对上一题中的()V A 和()W A ,()()V A W A +是否为直和? 说明理由。 解: 1、证明子空间,即为证明该空间关于加法和数乘封闭。即若有,()x y V A ∈,()()x y V A +∈,()kx V A ∈。 设,()x y V A ∈,k F ∈, ()()A x y Ax Ay xA yA x y A +=+=+=+,()()x y V A +∈∴ ()()A kx kAx kxA kx A ===, ()kx V A ∈∴ ∴()V A 是n n C ?的子空间。 2、若A 是单位矩阵,则} { ()n n V A X C IX XI ?===,因为对单位阵I 来说,IX XI =恒成立,故, ()n n V A C ?=。 3、若2n =,0011A ??= ?-??,设a b X c d ?? = ??? ,有AX XA =,即, 00001111000a b a b c d c d b b a c b d d d b a c d b d d ???????? = ??? ???--???????? -????= ? ?---????=?? -=??-=-? ,→ 有0b a c d =??-=?,故0a X c a c ??= ?-??=0000a c c a ????+ ? ?-???? 故X 的一组基为00101101,???? ? ?-???? ,维数为2。

东南大学电子学院《电路基础》期末考试样卷及答案

Solve the following problems. (100 points) 1、( 6 points) Find U ab in the circuit in Figure 1. Figure 1 a b 2、( 8 points) Find u o and i o in the circuit in Figure 2. u o Figure 2 - 3、( 6 points) In the circuit of Figure 3, readings of voltmeter ○V1,○V2 and ○ V3 are 10V , 18V and 6V , respectively. Please determinate the reading of the voltmeter ○V . a Figure 3 4、( 8 points) The resonant or tuner circuit of a radio is portrayed in Figure 4, where u s1 represents a broadcast signal, given that R =10Ω,L =200μH , U s1rms =1.5mV ,f 1=1008kHz. If the circuit is resonant with signal u s1, please determinate: (1) the value of C ; (2) the quality factor Q of the circuit; (3) the current I rms ; (4) the voltage U c rms .

东南大学编译原理试卷

S o u t h e a s t U n i v e r s i t y E x a m i n a t i o n P a p e r(A) Course Name Principles of Compiling Examination Term08-09-2 Score Related Major Computer Science & Technology Examination Form Close test Test Duration 150 Mins There are 8 problems in this paper. You can write the answers in English or Chinese on the attached paper sheets. 1.Please construct context-free grammars with ε-free productions for the following language (10%). {ω| ω∈(a,b,c)* and the numbers of a’s and b’s and c’s occurred in ω are even, and ωstarts with b , ends with a or c} 2.Please construct a DFA with minimum states for the following regular expression. (10%) (a|(a|(a|b*))*)*(a|b*) 3.Please eliminate the left recursions (if there are)and extract maximum common left factors (if there are) from the following context free grammar, and then decide the resulted grammar is whether a LL(1) grammar by constructing the related LL(1) parsing table.(15%) P→b S d Please obey the rules of examination. If you violate the rules, your answer sheets will be invalid 共 6 页第1 页

东南大学数字电路期末试卷

数字电路期末试卷一 一、设计一个模18计数器(共40分) 要求:1.设计电路,写出设计过程并将逻辑图画在答题纸;(15分) 2.用单脉冲或秒脉冲验证实验结果;(由老师检查)(15分) 3.用示波器或者逻辑分析仪观察并记录时钟与个位的低两位信号(Q1、Q0)波形。(10分) 二、设计一个具有自启动功能的序列信号发生器1011 (共60分) 要求:1.设计出电路图,写出设计过程并将逻辑图画在答题纸上;(20分) 2.根据设计搭试电路;(15分) 3.用指示灯验证电路的正确性,并检查该电路是否具有自启动功能;(15分) 4.用示波器或者逻辑分析仪观察波形,并将测试结果画在答题纸上。(由老师检查)(10分)

一、设计一个模18计数器(共40分) 要求:1.设计电路,写出设计过程并将逻辑图画在答题纸;(15分) 评分标准:原理图完全正确15分;若其中低位或者高位单独正确给5分; 如果两个单独均正确但级联错误给10分;接地不画扣2分。 2.用单脉冲或秒脉冲验证实验结果.(由老师检查)(15分) 3.记录结果(10分) 评分标准::相位对齐6分(每个输出端信号3分),画满一个周期3分,方波边沿画出1分。 二、1. 评分标准:原理图正确20分,输入没有使能端扣3分,接地不画扣2分。2.根据设计搭试电路;(15分) 3.用指示灯验证电路的正确性,并检查该电路是否具有自启动功能;(15分) 评分标准:实验操作,仪器使用5分,指示灯验证和自启动功能检查15分 4.用示波器或者逻辑分析仪观察波形,并将测试结果画在答题纸上.(由老师检查)(10分) 评分标准:波形观察记录,相位对齐6分,至少画满一个周期(3分),且画出边沿(1分)10分

C语言上机试题答案

//vc1 //prog1.cpp //设计一个程序,从键盘输入三个整数,按由小到大的顺序输出。#include"stdio.h" main() { int a[3],i,j,t; for(i=0;i<3;i++) { scanf("%d",&a[i]); } for(i=0;i<9;i++) /*此处的i可以小于任意一个大于6的整数*/ { for(j=0;j<2;j++) { if(a[j]>a[j+1]) t=a[j],a[j]=a[j+1],a[j+1]=t; } } printf("The three data from small to big is:"); for(i=0;i<3;i++) printf("%d ",a[i]); } //vc1 //prog2.cpp //求1+3+5+...+95+97+99的和。 #include"stdio.h" main() { int i,sum=0; for(i=1;i<100;i=i+2) sum+=i; printf("1+3+5+....+99=%d\n",sum); } //vc1 //prog3.cpp //写一个函数,从键盘输入一个整数,如果该整数为素数,则输出“此

整数为素数”,否则输出“整数非素数”。(注:要求从主函数输入整数)#include"stdio.h" main() { int i,j,k,l=2; printf("输入一个大于3的整数:"); scanf("%d",&i); for(j=2;j=0;i--) printf("%d ",a[i]); for(i=0;i<10;i++) sum+=a[i]; printf("The total is:%d\n",sum); } //vc2 //prog2.cpp //输入N个国家的英文名,要求按字母的先后顺序排列,并按照顺序输出。

相关主题
文本预览
相关文档 最新文档