宁波大学914c程序设计17-18年真题

合集下载

2023年浙江省宁波市全国计算机等级考试C++语言程序设计真题(含答案)

2023年浙江省宁波市全国计算机等级考试C++语言程序设计真题(含答案)

2023年浙江省宁波市全国计算机等级考试C++语言程序设计真题(含答案) 学校:________ 班级:________ 姓名:________ 考号:________一、1.选择题(10题)1.若进栈序列为a,b,C,则通过入出栈操作可能得到的a,b,C的不同排列个数为( )。

A.4B.5C.6D.72. 下列叙述中,错误的是()。

A.派生类可以使用private派生B.对基类成员的访问必须是无二义性的C.基类成员的访问能力在派生类中维持不变D.赋值兼容规则也适用于多继承的组合3.以下不是结构化程序设计方法的技术是()。

A.自顶向下,逐步求精B.自底向上,逐步求精C.从整体到局部D.结构清晰,层次分明4. 当一个函数无返回值时,函数的类型应为( )。

A.任意B.voidC.intD.char5. 有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point( int vx, int vy ) { x = vx; y = vy; } point ( ) x = 0; y= 0; } point operator+( point p1 ) { point p; int px = x+ p1.x; int py = y + p1.y; returnpoint( px, py ); point operator-( point p1 ) { point p; int px = x -p1.x; int py = y - p1.y; return point ( px, py ); } void print() { cout<<x<<" , "<<y<<end1; }};int main (){ point p1(10, 10 ), p2( 20, 20 ); p1 = p1 - p2; p1.print (); return 0;} 执行后的输出结果是A.10,10B.20,20C.10,20D.30,306.相对于数据库系统,文件系统的主要缺陷有数据关联差、数据不一致性和()。

宁波大学OJ系统240题

宁波大学OJ系统240题

1000 整数输入输出练习Description从键盘输入任意两个整数,再向屏幕输出这两个数据。

Input输入两个整数。

Output输出这两个整数。

以空格间隔。

Sample Input7 -9Sample Output7 -9HINT本题的样例代码如下:#include<stdio.h>int main(){int a,b;scanf("%d%d",&a,&b);printf("%d %d\n",a,b);return 0;1001 字符输入输出练习1 Description从键盘任意输入一个字符,再输出这个字符。

Input任意输入一个字符。

Output输出该字符。

Sample InputSample Output##include<stdio.h>int main(){char a;scanf("%c",&a);printf("%c\n",a);return 0;}1002 单组A+B Description从键盘输入任意两个整数a和b,计算并输出a+b的值。

Input从键盘输入两个整数a和b。

Output输出这两个数的和Sample Input1 2Sample Output3#include<stdio.h>int main(){int a,b,c;scanf("%d%d",&a,&b);c=a+b;printf("%d\n",c);return 0;}1003 多组A+B(1)Description分别计算多组a+b的值。

Input输入包含多组测试数据。

每行包含一组整数a,b。

当输入为0 0 时,测试结束,此时的结果不输出。

Output对于每一对整数a,b,输出它们的和,并且每行输出一个结果。

Sample Input1 510 200 0#include<stdio.h>int main(){int a,b,y;scanf("%d%d",&a,&b);while(a!=0||b!=0){y=a+b;printf("%d\n",y);scanf("%d%d",&a,&b);}return 0;}1004 多组A+B(2)Description分别计算多组a+b的值。

精编版-2016年浙江宁波大学C程序设计考研真题

精编版-2016年浙江宁波大学C程序设计考研真题

2016年浙江宁波大学C程序设计考研真题一、单项选择题:本大题共 30 小题,每小题 3 分,共 90 分。

在每小题列出的四个选项中只有一个是符合题目要求的。

错选、多选或未选均不得分。

1. 关于C语言中的函数,下列说法中错误的是___________A) 函数定义可以分为两个部分,即函数说明部分和函数体B) 主函数可以调用非主函数C) 某个非主函数可以调用其它非主函数D) 程序可以从任何函数开始执行2. C 语言中 while 和 do-while 循环的主要区别是___________A) do-while 的循环体至少无条件执行一次B) while 的循环控制条件比 do-while 的循环控制条件严格C) do-while 里面不允许使用 breakD) do-while 里面不允许使用 continue3. 在 C 语言程序中,以下说法正确的是___________A) 函数的定义可以嵌套,但函数的调用不可以嵌套B) 函数的定义不可以嵌套,但函数的调用可以嵌套C) 函数的定义和函数的调用都不可以嵌套D) 函数的定义和函数的调用都可以嵌套4. 下列字符列中,能作为某个变量的标识符是___________A) ?aB) a=2C) a.3D) a_35. 在以字节存储字符的系统中,字符‘\n ’在内存占用的字节数是___________A) 1B) 2C) 3D) 46. 下面的数字中,合法的长整型常数是___________A) 0LB) 4962710C) 0.054838743D) 2.1869e107. 下面正确表示字符常量的是___________A) "\n"B) '\t'C) "0"D) 658. 输出字符型变量 x 与整型变量 y,下列 printf 语句使用正确的是___________A) printf ("%f%s", x, y);B) printf ("%lf%c", x, y) ;C) printf ("%c%d", x, y);D) scanf ("%f%c", x, y) ;9. 为表示关系 x≥y≥z,应使用 C 语言表达式___________A) (x>=y>=z)B) (x>=y) AND (y>=z)C) (x>=y) && (y>=z)D) (x>=y) & (y>=z)10. C 语言对 if 嵌套语句的规定 else 总是与___________配对。

宁波大学考研真题914C程序设计初试试卷(B卷)硕士研究生专业课考试试题(2018年)

宁波大学考研真题914C程序设计初试试卷(B卷)硕士研究生专业课考试试题(2018年)

A)1
B)0
C)-1
D)出错
(10)在循环语句的循环体中,break 语句的作用是( ) A)继续执行 break 语句之后的循环体内其他各语句; B)提前结束本层循环,接着执行该循环体后续的语句; C)结束本次循环; D)暂停程序的运行.
(11)若用数组名作为函数调用的实参,传递给形参的是( )
A)数组的首地址
swap(int p,int q)
{
int t;
t=p;p=q;q=t;
}
Int main()
{
int a=10,b=20;
pirntf("(1) a=%d,b=%d\n",a,b);
swap(&a,&b);
printf("(2) a=%d,b=%d\n",a,b);
return 0;
}
(A) 该程序完全正确
return 0;
}
程序运行后的输出结果是( )
A) 12
B) 15
C) 6
D) 5
(8) 有以下程序
struct STU
{ char num[10]; float score[3]; };
main()
{ struct STU s[3]={{"20021",90,95,85},
{"20022",95,80,75},
题目 1:逆序数 【问题描述】给定一个整数(正整数、负整数、零),请输出它的逆序数。 【样例输入】 -12300 【样例输出】 -321
题目 2:统计单词个数 【问题描述】统计一个英文句子(长度不大于 80)中含有英文单词的个数,单词之间用空格隔开。 【样例输入】

浙江科技学院C程序设计2017--2020年考研初试真题

浙江科技学院C程序设计2017--2020年考研初试真题

第 10页,共 15页
机密 ★ 考试结束前
5. 下列程序将数组名作为函数参数,求平均成绩。请填空。 #include<stdio.h> float aver(______(13)______,int n) { int i; float av,s = a[0]; for(i = 1; i < n; i ++) s += a[i]; av = s / n; ______(14)______ ; } int main() { float sco[5],av; int i; for(i = 0; i < 5; i ++) scanf("%f",sco + i); av = aver(_____(15)______ , 5); printf("average score is %5.2f\n",av); return 0; }
【程序】 #include <stdio.h> int prime(int n); void guess(int n);
第 7页,共 15页
机密 ★ 考试结束前
void main() {
int n,n1,n2; do {
printf("Please input an even number(>=6):"); scanf("%d",&n); }while(!(n>=6&&n%2==0)); guess(n); } void guess(int n) { int n1,n2; for(n1=3;n1<=n/2;n1+=2) { n2=n-n1; if(____(4)____)

宁波大学2017年考研真题【信息科学与工程学院】911电子线路(模拟电路+数字电路)初试试卷(A卷)

宁波大学2017年考研真题【信息科学与工程学院】911电子线路(模拟电路+数字电路)初试试卷(A卷)

科目代码:911科目名称:电子线路(模拟电路+数字电路)适用专业:电路与系统通信与信息系统信号与信息处理电子与通信工程集成电路工程计算机技术一、单项选择题(本大题共5小题,每小题5分,共25分)1.电路如图1所示,二极管的导通电压0.7V D U =,则图1中二极管的工作状态及输出电压值为()。

A 、D1导通,D2截止,0.7V O U =B 、D1截止,D2导通, 5.3V O U =-C 、D1截止,D2截止,12V O U =D 、D1导通,D2导通,0.7V O U =2.对于RC 耦合单管共射放大电路,若其上、下限频率分别为H f 、L f ,则当L f f =时,下列描述正确的是()。

A 、o U 滞后i U 45︒B 、o U 滞后i U ︒135C 、o U 超前iU ︒45D 、o U 超前iU 135︒3.如下图2所示单相桥式整流、电容滤波电路,电容量足够大时,已知副边电压有效值为210V U =,测得输出电压的平均值() 4.5V O AV U =,则下列描述正确的是()。

A 、电路正常工作B 、电容C 开路C 、负载R L 开路D 、电容C 和二极管D 1同时开路图2图24.为了克服零点漂移,通用型运放的输入级大多采用()。

A 、共射电路B 、共集电路C 、差动放大电路D 、OCL 互补对称功放电路5.关于多级放大电路下列说法中错误的是()。

A 、Au 等于各级电压放大倍数之积;B 、Ri 等于输入级的输入电阻;C 、Ro 等于输出级的输出电阻;D 、级数越多,通频带越宽。

图1D1D212V+_U O 6V3kΩ科目代码:911科目名称:电子线路(模拟电路+数字电路)适用专业:电路与系统通信与信息系统信号与信息处理电子与通信工程集成电路工程计算机技术二、填空题:(每小题5分,共5题,共25分)1.用卡诺图化简法将Y ABC ABD C D ABC ACD ACD =+++++化为最简与或形式2.求逻辑函数Y ABC AC BC =++的最小项之和形式3.写出图3的输出逻辑函数式图34.在CMOS 电路中有时采用图4所示的扩展功能用法,写出Y 的逻辑式。

2018年浙江省大学生程序设计竞赛试题

2018年浙江省大学生程序设计竞赛试题

The 15th Zhejiang Provincial Collegiate Programming ContestSponsored byContest SectionApril 29, 2018Problem ListThis problem set should contain 13 (thirteen) problems on 17 (seventeen) numbered pages. Please inform a runner immediately if something is missing from your problem set.Prepared by Zhejiang University ACM/ICPC Problem Setter Team.Problem A.PeakDescriptionA sequence of n integers a1,a2,...,a n is called a peak,if and only if there exists exactly one integer k such that1<k<n,and a i<a i+1for all1≤i<k,and a i−1>a i for all k<i≤n.Given an integer sequence,please tell us if it’s a peak or not.InputThere are multiple test cases.Thefirst line of the input contains an integer T,indicating the number of test cases.For each test case:Thefirst line contains an integer n(3≤n≤105),indicating the length of the sequence.The second line contains n integers a1,a2,...,a n(1≤a i≤2×109),indicating the integer sequence. It’s guaranteed that the sum of n in all test cases won’t exceed106.OutputFor each test case output one line.If the given integer sequence is a peak,output“Yes”(without quotes), otherwise output“No”(without quotes).Examplestandard input standard output7515732 512121 41234 44321 31213212512312Yes No No No Yes No NoProblem B.King of KaraokeDescriptionIt’s Karaoke time!DreamGrid is performing the song Powder Snow in the game King of Karaoke.The song performed by DreamGrid can be considered as an integer sequence D1,D2,...,D n,and the standard version of the song can be considered as another integer sequence S1,S2,...,S n.The score is the number of integers i satisfying1≤i≤n and S i=D i.As a good tuner,DreamGrid can choose an integer K(can be positive,0,or negative)as his tune and add K to every element in D.Can you help him maximize his score by choosing a proper tune? InputThere are multiple test cases.Thefirst line of the input contains an integer T(about100),indicating the number of test cases.For each test case:Thefirst line contains one integer n(1≤n≤105),indicating the length of the sequences D and S. The second line contains n integers D1,D2,...,D n(−105≤D i≤105),indicating the song performed byDreamGrid.The third line contains n integers S1,S2,...,S n(−105≤S i≤105),indicating the standard version of the song.It’s guaranteed that at most5test cases have n>100.OutputFor each test case output one line containing one integer,indicating the maximum possible score. Examplestandard input standard output24123423465-5-4-3-2-1 543213 1NoteFor thefirst sample test case,DreamGrid can choose K=1and changes D to{2,3,4,5}.For the second sample test case,no matter which K DreamGrid chooses,he can only get at most1match.Problem C.Magic12MonthsDescriptionIt’s New Year’s Eve,and it’s also the best time of the year to play the card game Magic12Months to pray for good luck of the coming year.BaoBao has just found a deck of standard52playing cards(without Jokers)in his pocket and decides to play the game.The rules are as follows:1.Setup1.1.Remove the four‘K’s from the52cards.1.2.Shuffle the remaining48cards and divide them face down into12piles(4cards per pile)withequal probability.2.Gameplay2.1.Let p=1.2.2.Flip the card on the top of the p-th pile,check its rank r,and discard the card.2.3.If r is a number,let p=r;If r=‘A’,let p=1;If r=‘J’,let p=11;If r=‘Q’,let p=12.2.4.If the p-th pile is empty,the game ends;Otherwise go back to step2.2.When the game ends,having all the4cards of rank mflipped and discarded indicates that the m-th month in the coming year is a lucky month.BaoBao is in the middle of the game and has discarded n cards.He wants to know the probability that the i-th month of the coming year is a lucky month for all1≤i≤12when the game ends.Given these n cards,please help him calculate the answer.InputThere are multiple test cases.Thefirst line of input contains an integer T(about100)–the number of test cases.For each test case:Thefirst and only line contains an integer n(0≤n≤48)–the number offlipped cards,followed by the rank of the n cards r1,r2,...,r n(r i∈{A,2,3,4,5,6,7,8,9,10,J,Q})separated by a space in the order they areflipped.It’s guaranteed that the input describes a valid and possible situation of the game.OutputFor each test case output one line containing12numbers separated by a space,where the i-th number indicates the probability that the i-th month of the coming year is a lucky month.You should output a probability in its simplest fraction form A/B where A and B are coprime.Specifically, if the probability equals0,you should output0;If the probability equals1,you should output1. Please,DO NOT output extra spaces at the end of each line,or your answer may be considered incorrect! Examplestandard input3309Q10J Q10J10J J85765767663A24A2424472A3A4A Astandard output12/32/511/212/32/52/52/311/211/21/21/21/21/21/21/21/21/21/21/2100000000000Problem D.Sequence SwappingDescriptionBaoBao has just found a strange sequence{<s1,v1>,<s2,v2>,...,<s n,v n>}of length n in his pocket. As you can see,each element<s i,v i>in the sequence is an ordered pair,where thefirst element s i in the pair is the left parenthesis‘(’or the right parenthesis‘)’,and the second element v i in the pair is an integer.As BaoBao is bored,he decides to play with the sequence.At the beginning,BaoBao’s score is set to 0.Each time BaoBao can select an integer k,swap the k-th element and the(k+1)-th element in the sequence,and increase his score by(v k×v k+1),if and only if1≤k<n,s k=‘(’and s k+1=‘)’. BaoBao is allowed to perform the swapping any number of times(including zero times).What’s the maximum possible score BaoBao can get?InputThere are multiple test cases.Thefirst line of the input contains an integer T,indicating the number of test cases.For each test case:Thefirst line contains an integer n(1≤n≤103),indicating the length of the sequence.The second line contains a string s(|s|=n)consisting of‘(’and‘)’.The i-th character in the string indicates s i,of which the meaning is described above.The third line contains n integers v1,v2,...,v n(−103≤v i≤103).Their meanings are described above. It’s guaranteed that the sum of n of all test cases will not exceed104.OutputFor each test case output one line containing one integer,indicating the maximum possible score BaoBao can get.Examplestandard input standard output46)())()135-132 6)())()135-10032 3())1-1-13())-1-1-124 21 0 2NoteFor thefirst sample test case,the optimal strategy is to select k=2,3,5,4in order. For the second sample test case,the optimal strategy is to select k=2,5in order.Problem E.LISDescriptionDreamGrid is learning the LIS(Longest Increasing Subsequence)problem and he needs tofind the longest increasing subsequence of a given sequence a1,a2,...,a n of length n.Recall that•A subsequence b1,b2,...,b m of length m is a sequence satisfying b1=a k1,b2=a k2,...,b m=a kmand1≤k1<k2<···<k m≤n.•An increasing subsequence b1,b2,...,b m is a subsequence satisfying b1<b2<···<b m. DreamGrid defines the helper sequence f1,f2,...,f n where f i indicates the maximum length of the increasing subsequence which ends with a i.In case you don’t know how to derive the helper sequence,he provides you with the following pseudo-code which calculates the helper sequence.procedure lis_helper(a:original sequence){Let n be the length of the original sequence,f(i)be the i-th element in sequence f,and a(i)be the i-th element in sequence a}for i:=1to nf(i):=1for j:=1to(i–1)if a(j)<a(i)and f(j)+1>f(i)f(i):=f(j)+1return f{f is the helper sequence}DreamGrid has derived the helper sequence using the program,but the original sequence a1,a2,...,a n is stolen by BaoBao and is lost!All DreamGrid has in hand now is the helper sequence and two range sequences l1,l2,...,l n and r1,r2,...,r n indicating that l i≤a i≤r i for all1≤i≤n.Please help DreamGrid restore the original sequence which is compatible with the helper sequence and the two range sequences.InputThere are multiple test cases.Thefirst line of the input contains an integer T,indicating the number of test cases.For each test case:Thefirst line contains an integer n(1≤n≤105),indicating the length of the original sequence.The second line contains n integers f1,f2,...,f n(1≤f i≤n)seperated by a space,indicating the helper sequence.For the following n lines,the i-th line contains two integers l i and r i(0≤l i≤r i≤2×109),indicating the range sequences.It’s guaranteed that the original sequence exists,and the sum of n of all test cases will not exceed5×105. OutputFor each test case output one line containing n integers separated by a space,indicating the original sequence.If there are multiple valid answers,print any of them.Please,DO NOT print extra spaces at the end of each line,or your solution may be considered incorrect!Examplestandard input standard output46123243 052433123515512131 100200 200300 200400 400500 10050071231142 030303030303032111223123253 200300200500200 012003122Problem F.Now Loading!!!DescriptionDreamGrid has n integers a1,a2,...,a n.DreamGrid also has m queries,and each time he would like toknow the value of∑1≤i≤n ⌊ai⌈log p a i⌉⌋for a given number p,where⌊x⌋=max{y∈Z|y≤x},⌈x⌉=min{y∈Z|y≥x}.InputThere are multiple test cases.Thefirst line of input is an integer T indicating the number of test cases. For each test case:Thefirst line contains two integers n and m(1≤n,m≤5×105)–the number of integers and the number of queries.The second line contains n integers a1,a2,...,a n(2≤a i≤109).The third line contains m integers p1,p2,...,p m(2≤p i≤109).It is guaranteed that neither the sum of all n nor the sum of all m exceeds2×106.OutputFor each test case,output an integer(m ∑i=1i·z i)mod109,where z i is the answer for the i-th query. Examplestandard input standard output232 100100010000 1001045 2323223123123 123232423511366 45619Problem G.JUMPin’JUMP UP!!!DescriptionTired of solving mathematical equations,DreamGrid starts to solve equations related to strings:for two strings x and y with the same length consisting of lowercase English letters,calculate f(x,y,n),which is defined as the number of nonempty strings z consisting of lowercase English letters such that xz=zy and the length of z does not exceed n.DreamGrid has two strings s=s1s2...s n and t=t1t2...t m.He would like to ask several questions about the value of f(t,s[x..(x+m−1)],y),where s[x..(x+m−1)]is the substring of s starting from s x with length m and y is a given number.InputThere are multiple test cases.Thefirst line of input contains an integer T,indicating the number of test cases.For each test case:Thefirst line contains three integers n and m and q(1≤n,m,q≤105,m≤n)–the length of s,the length of t and the number of questions.The second line contains n lowercase English letters denoting the string s.The third line contains m lowercase English letters denoting the string t.Each of the next q lines contains two integers x i and y i(1≤x i≤n+1−m,1≤y i≤1018)denoting the i-th question.It is guaranteed that neither the sum of all n nor the sum of all q exceeds106.OutputFor each question,output an integer denoting the answer.Examplestandard input standard output1 423 abcd ba12 22 321 0 0Problem H.Game on a TreeDescriptionBaoBao is playing a game on a rooted tree with n vertices and(n−1)weighted edges.At the beginning of the game,a chess piece is placed on the root of the tree,which is vertex1.In each step,BaoBao can perform one of the four operations:1.Move the chess piece along an edge from its current vertex to a child vertex.This operation willcost BaoBao w units of value,where w is the weight of the edge.2.Jump the chess piece back to vertex1.This operation is free and won’t cost BaoBao any unit ofvalue.3.Set a“save point”on the current vertex of the chess piece.If a save point has been set on someother vertex before,the save point on the old vertex will be removed(so there will be at most one save point on the tree at the same time).This operation is free and won’t cost BaoBao any unit of value.4.Jump the chess piece back to the save point(the save point must be set before this operation).Thisoperation is free and won’t cost BaoBao any unit of value.The goal of the game is to visit every leaf vertex of the tree using the chess piece.Please help BaoBao calculate the minimum units of value he has to spend to achieve the goal.Recall that a leaf vertex of a tree is a vertex with no child.InputThere are multiple test cases.Thefirst line of the input contains an integer T,indicating the number of test cases.For each test case:Thefirst line contains one integer n(2≤n≤200),indicating the size of the tree.The following(n−1)lines each contains three integers u i,v i and w i(1≤u i,v i≤n,1≤w i≤109), indicating an edge connecting vertex u i and vertex v i with weight w i in the tree.It’s guaranteed that the given graph is a tree,and the sum of n over all test cases will not exceed2000. OutputFor each test case output one line containing one integer,indicating the minimum units of value BaoBao has to spend to achieve the goal.Example standardinputstandard output 381213112425426223738338121231341351261671681812100231341351261671681148107NoteThe trees of the sample test cases are shown above.For the first sample test case,BaoBao should perform the following operations:go to 2,save on 2,go to 4,go to 5,back to save (2),go to 6,back to root (1),go to 3,save on 3,go to 7,back to save (3),go to 8.For the second sample test case,BaoBao should perform the following operations:go to 2,go to 3,save on 3,go to 4,back to save (3),go to 5,back to root (1),go to 2,go to 6,save on 6,go to 7,back to save(7),go to 8.For the third sample test case,BaoBao should perform the following operations:go to 2,save on 2,go to 3,go to 4,back to save (2),go to 3,go to 5,back to save (2),go to 6,save on 6,go to 7,back to save (6),go to 8.Problem I.Magic PointsDescriptionGiven an integer n ,we say a point (x,y )on a 2D plane is a magic point,if and only if both x and y are integers,and exactly one of the following conditions is satisfied:•0≤x <n and y =0;•0≤x <n and y =n −1;•x =0and 0≤y <n ;•x =n −1and 0≤y <n .It’s easy to discover that there are 4n −4magic points in total.These magic points are numbered from 0to 4n −5in counter-clockwise order starting from (0,0).DreamGrid can create n magic lines from these magic points.Each magic line passes through exactly two magic points but cannot be parallel to the line x =0or y =0(that is to say,the coordinate axes).The intersections of the magic lines are called dream points,and for some reason,DreamGrid would like to make as many dream points as possible.Can you tell him how to create these magic lines?InputThere are multiple test cases.The first line of input contains an integer T (about 100),indicating the number of test cases.For each test case,there is only one integer n (2≤n ≤1000).OutputFor each case output 2n integers p 1,p 2,...,p 2n in one line separated by one space,indicating that in your answer,point p 2k −1and point p 2k is connected by a line for all 1≤k ≤n .If there are multiple answers,you can print any of them.Example standard inputstandard output32340213142536061938410NoteThe sample test cases are shown as follow:Problem J.CONTINUE...?DescriptionDreamGrid has n classmates numbered from1to n.Some of them are boys and the others are girls.Each classmate has some gems,and more specifically,the i-th classmate has i gems.DreamGrid would like to divide the classmates into four groups G1,G2,G3and G4such that:•Each classmate belongs to exactly one group.•Both G1and G2consist only of girls.Both G3and G4consist only of boys.•The total number of gems in G1and G3is equal to the total number of gems in G2and G4.Your task is to help DreamGrid group his classmates so that the above conditions are satisfied.Note that you are allowed to leave some groups empty.InputThere are multiple test cases.Thefirst line of input is an integer T indicating the number of test cases. For each test case:Thefirst line contains an integer n(1≤n≤105)–the number of classmates.The second line contains a string s(|s|=n)consisting of0and1.Let s i be the i-th character in the string s.If s i=1,the i-th classmate is a boy;If s i=0,the i-th classmate is a girl.It is guaranteed that the sum of all n does not exceed106.OutputFor each test case,output a string consists only of{1,2,3,4}.The i-th character in the string denotes the group which the i-th classmate belongs to.If there are multiple valid answers,you can print any of them;If there is no valid answer,output“-1”(without quotes)instead.Examplestandard input standard output5112103101400007 1101001-1-1314 1221 3413214Problem K.Mahjong SortingDescriptionDreamGrid has just found a set of Mahjong with3M suited tiles and a White Dragon tile in his pocket. Each suited tile has a suit(Character,Bamboo or Dot)and a rank(ranging from1to M),and there is exactly one tile of each rank and suit combination.Character tiles whose rank ranges from1to9Bamboo tiles whose rank ranges from1to9Dot tiles whose rank ranges from1to9White Dragon tileAs DreamGrid is bored,he decides to play with these tiles.Hefirst selects one of the3M suited tiles as the“lucky tile”,then he picks N tiles from the set of(3M+1)tiles and sorts these N tiles with the following rules:•The“lucky tile”,if contained in the N tiles,must be placed in the leftmost position.•For two tiles A and B such that neither of them is the“lucky tile”,if–A is a Character tile and B is a Bamboo tile,or–A is a Character tile and B is a Dot tile,or–A is a Bamboo tile and B is a Dot tile,or–A and B have the same suit and the rank of A is smaller than the rank of B, then A must be placed to the left of B.White Dragon tile is a special tile.If it’s contained in the N tiles,it’s considered as the original(not-lucky)version of the lucky tile during the sorting.For example,consider the following sorted tiles,where “3Character”is selected as the lucky tile.White Dragon tile,in this case,is considered to be the original not-lucky version of“3Character”and should be placed between“2Character”and“4Character”.As DreamGrid is quite forgetful,he immediately forgets what the lucky tile is after the sorting!Given N sorted tiles,please tell DreamGrid the number of possible lucky tiles.InputThere are multiple test cases.Thefirst line of the input contains an integer T,indicating the number of test cases.For each test case:Thefirst line contains two integers N and M(1≤N,M≤105,N≤3M+1),indicating the number of sorted tiles and the maximum rank of suited tiles.For the next N lines,the i-th line describes the i-th sorted tile counting from left to right.The line begins with a capital letter s i(s i∈{C,B,D,W}),indicating the suit of the i-th tile:•If s i=C,then an integer r i(1≤r i≤M)follows,indicating that it’s a Character tile with rank r i;•If s i=B,then an integer r i(1≤r i≤M)follows,indicating that it’s a Bamboo tile with rank r i;•If s i=D,then an integer r i(1≤r i≤M)follows,indicating that it’s a Dot tile with rank r i;•If s i=W,then it’s a White Drangon tile.It’s guaranteed that there exists at least one possible lucky tile,and the sum of N in all test cases doesn’t exceed106.OutputFor each test case output one line containing one integer,indicating the number of possible lucky tiles. Examplestandard input standard output439 C2 WC4 69 C2 C7 WB3 B4 D2 3100 C2 WC9 39 C1 B2 D32 4 7 25NoteFor thefirst sample,“2Character”and“3Character”are possible lucky tiles.For the second sample,“8Character”,“9Character”,“1Bamboo”and“2Bamboo”are possible lucky tiles.Problem L.Doki Doki Literature ClubDescriptionDoki Doki Literature Club!is a visual novel developed by Team Salvato.The protagonist is invited by his childhood friend,Sayori,to join their high school’s literature club.The protagonist then meets the other members of the club:Natsuki,Yuri,and the club president Monika.The protagonist starts to participate in the club’s activities such as writing and sharing poetry,and grows close to the four girls.What a lovely story!A very important feature of the game is its poetry writing mechanism.The player is given a list of various words to select from that will make up his poem.Each girl in the Literature Club has different word preferences,and will be very happy if the player’s poem is full of her favorite words.The poem writing mini-game(from wikipedia)BaoBao is a big fan of the game and likes Sayori the most,so he decides to write a poem to please Sayori.A poem of m words s1,s2,...,s m is nothing more than a sequence of m strings,and the happiness of Sayori after reading the poem is calculated by the formulaH=m∑i=1(m−i+1)·f(s i)where H is the happiness and f(s i)is Sayori’s preference to the word s i.Given a list of n words and Sayori’s preference to each word,please help BaoBao select m words from the list andfinish the poem with these m words to maximize the happiness of Sayori.Please note that each word can be used at most once!InputThere are multiple test cases.Thefirst line of input contains an integer T(about100),indicating the number of test cases.For each test case:Thefirst line contains two integers n and m(1≤m≤n≤100),indicating the number of words and the length of the poem.For the following n lines,the i-th line contains a string consisting of lowercased English letters w i (1≤|w i|≤15)and an integer f(w i)(−109≤f(w i)≤109),indicating the i-th word and Sayori’s preference to this word.It’s guaranteed that w i=w j for all i=j.OutputFor each test case output one line containing an integer H and m strings s1,s2,...,s m separated by one space,indicating the maximum possible happiness and the corresponding poem.If there are multiple poems which can achieve the maximum happiness,print the lexicographically smallest one.Please,DO NOT output extra spaces at the end of each line,or your answer may be considered incorrect!A sequence of m strings a1,a2,...,a m is lexicographically smaller than another sequence of m strings b1,b2,...,b m,if there exists a k(1≤k≤m)such that a i=b i for all1≤i<k and a k is lexicographically smaller than b k.A string s1=a1a2...a x is lexicographically smaller than another string s2=b1b2...b y,if there exists a k(1≤k≤min(x,y))such that a i=b i for all1≤i<k and a k<b k,or a i=b i for all1≤i≤min(x,y) and x<y.Examplestandard input standard output4108hello0world0 behind0far1be2spring10can15comes20 winter25if20055collegiate0 programming-5 zhejiang10 provincial5 contest-4532bcda1bcd1bbbbb132a1aa1aaa12018if winter comes can spring be far behind15zhejiang provincial collegiate programming contest 3bbbbb bcd3a aaProblem M.Lucky7DescriptionBaoBao has just found a positive integer sequence a1,a2,...,a n of length n from his left pocket and another positive integer b from his right pocket.As number7is BaoBao’s favorite number,he considers a positive integer x lucky if x is divisible by7.He now wants to select an integer a k from the sequence such that(a k+b)is lucky.Please tell him if it is possible.InputThere are multiple test cases.Thefirst line of the input is an integer T(about100),indicating the number of test cases.For each test case:Thefirst line contains two integers n and b(1≤n,b≤100),indicating the length of the sequence and the positive integer in BaoBao’s right pocket.The second line contains n positive integers a1,a2,...,a n(1≤a i≤100),indicating the sequence. OutputFor each test case output one line.If there exists an integer a k such that a k∈{a1,a2,...,a n}and(a k+b) is lucky,output“Yes”(without quotes),otherwise output“No”(without quotes).Examplestandard input standard output4374563747652 25252 426 100124No Yes Yes YesNoteFor thefirst sample test case,as4+7=11,5+7=12and6+7=13are all not divisible by7,the answer is“No”.For the second sample test case,BaoBao can select a7from the sequence to get7+7=14.As14is divisible by7,the answer is“Yes”.For the third sample test case,BaoBao can select a5from the sequence to get5+2=7.As7is divisible by7,the answer is“Yes”.For the fourth sample test case,BaoBao can select a100from the sequence to get100+26=126.As 126is divisible by7,the answer is“Yes”.。

宁波大学信号与系统2018—2020年考研真题试题

宁波大学信号与系统2018—2020年考研真题试题
2.(14 分)试计算卷积 e2tu(t) tnu(t) [ ''(t) 3 '(t) 2 (t)]etu(t) 。
3.(14 分)一个因果 LTI 系统,其输入 x(t) 、输出 y(t) 用下列微分-积分方程表示:
d y(t) 5y(t) x( ) f (t )d x(t)
dt
其中 f (t) etu(t) 3 (t) ,试求该系统单位冲激响应 h(t) 。
宁波大学 2020 年硕士研究生招生考试初试试题(B 卷)
(答案必须写在考点提供的答题纸上)
科目代码: 912 总分值: 150 科目名称:
信号与系统
1. (10 分)试计算卷积积分: y(t) 1 * 1 tt
2. (8 分)试计算卷积和: y(n) bnu(n 1) * bnu(n 2), 其中 b 1。
x(n)
u(n)
时,输出响应
y(n)
1 2
4(2)n
5 2
(3)n
u(n)
。求此系统的差分方程。
10.(12 分)已知二阶离散时间因果 LTI 系统的框图如题 10 图所示。 (1)求系统函数,并判断系统的稳定性;
(2)设抽样频率为 10kHz,输入正弦幅度为 5,频率为 1kHz,试求稳态输出幅度。
4. (18 分)一线性时不变一阶系统,在以下三种激励下,其起始状态均相同,当激励 x1(t) (t) 时 , 其 全 响 应 为 y1(t) (t) etu(t) ; 当 激 励 x2 (t) u(t) 时 , 其 全 响 应 为 y2 (t) 3etu(t) ;当激励 x3 (t) u(t) u(t 1) 时,求系统全响应。
X (z)
2z2 z2 1 z

浙江理工大学2017—2018学年第2学期《C#程序设计》期末试卷(B)卷

浙江理工大学2017—2018学年第2学期《C#程序设计》期末试卷(B)卷

浙江理工大学2017—2018学年第2学期《C#程序设计》期末试卷(B)卷浙江理工大学2017—2018学年第2学期《C#程序设计》期末试卷(B)卷本人郑重承诺:本人已阅读并且透彻地理解《浙江理工大学考场规则》,愿意在考试中自觉遵守这些规定,保证按规定的程序和要求参加考试,如有违反,自愿按《浙江理工大学学生违纪处分规定》有关条款接受处理。

承诺人签名:学号:班级:一、单选题(在每小题的四个备选答案中选出一个正确答案,并将正确答案的序号填入题后的括号内。

每小题2分,共30分。

)(1) 以下关于结构的说法,正确的是()A. 结构不可以通过ref或out形参以引用方式传递给函数成员B. 结构是值类型,类是引用类型C. 结构和类一样,均支持继承D.结构允许声明无形参的实例构造函数(2) 下列类型中, 哪些不属于引用类型?()。

A.String B.int C.Class D.Delegate(3) 下列关于多态的说法中,哪个选项是正确的()。

A.重写虚方法时可以为虚方法指定别称B.抽象类中不可以包含虚方法C.虚方法是实现多态的唯一手段D.多态性是指以相似的手段来处理各不相同的派生类。

(4) .NET框架是.NET战略的基础,是一种新的便捷的开发平台,它具有两个主要的组件,分别是( )和类库。

A.公共语言运行库B.Web服务C.命名空间D.Main()函数(5) 下列的( )不是构造函数的特征?A.构造函数的函数名和类名相同B.构造函数可以重载C.构造函数可以带有参数D.可以指定构造函数的返回值(6) 指定操作系统读取文件方式中的FileMode .Create的含义是()。

A.打开现有文件B.指定操作系统应创建文件,如果文件存在,将出现异常C.打开现有文件,若文件不存在,出现异常D.指定操作系统应创建文件,如果文件存在,将被改写(7) 调用方法时,如果想给方法传递任意个数的参数时,应选用()关键字。

A.ref B.out C.params D.无特殊要求(8) 要使一个对象能够通过序列化输出,其所属的类必须用()特性修饰。

宁波大学931工程热力学17-20年真题

宁波大学931工程热力学17-20年真题

宁波大学2017年硕士研究生招生考试初试试题(A 卷)(答案必须写在考点提供的答题纸上)科目代码:931科目名称:工程热力学适用专业:船舶与海洋结构物设计制造轮机工程港航技术与管理工程船舶与海洋工程第1页共2页一、简答题(本大题共12小题,每小题8分,共96分)1、简述热力学第一、第二定律分别是什么?2、工质边被压缩边吸入热量可以否?对工质加热,其温度反而降低,有否可能?3、在热力学能、焓、熵、功和热量这些参数中,哪些量是状态量?哪些量是过程量?4、一个热力系统中熵的变化可分为熵流和熵产,分别说明它们的含义,并指出它们的正负号。

5、理想气体绝热节流后,其状态参数熵、焓、温度各自怎么变化(回答“不变”、或“增大”、或“降低”、或“不确定”)?6、“循环功越大,则热效率越高”;“可逆循环热效率都相等”;“不可逆循环效率一定小于可逆循环效率”。

这些结论是否正确?为什么?7、下述说法是否正确,为什么?(1)若从某一初态经可逆与不可逆两条途径到达同一终态,则不可逆途径的∆S 必大于可逆过程途径的∆S ;(2)工质经不可逆循环,0∆>S ;8、某一湿蒸汽中,饱和水蒸气的质量为A ,饱和水的质量为B ,请写出干度x 的表达式。

饱和水与饱和蒸汽的干度分别为多少?9、是否可用制冷机产生低温,作为热机的冷源,提高热机循环的热效率,从而提高能源的利用效率,试分析之。

10、简述提高混合加热内燃机理想循环的热效率措施有哪些?11、为什么在烘干过程中总是先把烘干用的湿空气加热到较高的温度?12、在制冷装置中可以使热量从低温物体(冷库)转移到高温物体(大气)。

问此过程是否违背热力学第二定律?二、计算题(本大题共4小题,共54分)1、(12分)压力为0.1MPa ,温度为20°C 的1kg 空气经绝热压缩后,压力变为2MPa ,温度升到400°C ,过程中熵的变化为多少?这一过程能否实现?(空气的p c =1.004k /(kg )∙J K ,g =0.287k /(kg )∙R J K )。

宁波大学2612c语言程序设计2017年考博专业课真题

宁波大学2612c语言程序设计2017年考博专业课真题

12.若指针 px 为空指针,则 ( A.px 指向不定
B.px 的值为零
13.对于语句 int *px[10],以下说法正确的是(
A. px 是一个指针,指向一个数组,数组的元素是整数型。 B. px 是一个数组,其数组的每一个元素是指向整数的指针。 C. A 和 B 均错,但它是 C 语言的正确语句。 D. C 语言不允许这样的语句。 14.具有相同基类型的指针变量 P 和数组变量 Y,下列写法中不合法的是( A.P = Y B.*P = Y[i] C.P + &Y[i] D.P = &Y ) )。
D.21 个字符 )。 D.float(int n)
8.将 int 型变量 n 转换成 float 型变量的方法是 ( A.float n B.(float)n C.float(n)
第 1 页 共 8 页
宁波大学 2017 年博士研究生招生考试初试试题(A 卷)
(答案必须写在考点提供的答题纸上)
科目代码:
宁波大学 2017 年博士研究生招生考试初试试题(A 卷)
(答案必须写在考点提供的答题纸上)
科目代码:
2612
科目名称:
C 语言程序设计
一、选择题(共 25 分,每题 1 分)
1.下列说法中错误的是( )。
A. 主函数可以分为两个部分:主函数说明部分和主函数体 B. 主函数可以调用任何非主函数的其他函数 C. 任何非主函数可以调用其他任何非主函数 D. 程序可以从任何非主函数开始执行 2.转换说明符%d 的输出形式是( A.十进制 B.八进制 )。 D.二进制
4.int x=3,y=2;则表达式 x+=y+8 的值为( A. 28 B. 30 C. 13 D.

宁波大学C语言高级程序设计与算法2017--2018,2020年考博初试真题

宁波大学C语言高级程序设计与算法2017--2018,2020年考博初试真题

(答案必须写在考点提供的答题纸上)(答案必须写在考点提供的答题纸上)(答案必须写在考点提供的答题纸上)(答案必须写在考点提供的答题纸上)(答案必须写在考点提供的答题纸上)科目代码:2612 总分值:100 科目名称:C语言程序设计四、编程题(每题10分,共30分)题目1:最小和最大素数给定一个范围[x1,x2],要求计算出该范围内的最小素数和最大素数。

Input:输入x1,x2(1<x1<x2<1000)Output:输出给定范围里的最小素数和最大素数;如果没有素数,输出No Answer。

Sample Input:2 155Sample Output:2 151题目2:字符替换Description:把一个字符串中特定的字符全部用给定的字符替换,得到一个新的字符串。

Input:只有一行,由一个字符串和两个字符组成,中间用单个空格隔开。

字符串是待替换的字符串,字符串长度小于等于30个字符,且不含空格等空白符;接下来一个字符为需要被替换的特定字符;接下来一个字符为用于替换的给定字符。

Output:一行,即替换后的字符串。

Sample Input:hello-how-are-you o OSample Output:hellO-hOw-are-yOu题目3:明明的随机数Description:明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。

然后再把这些数从小到大排序,按照排好的顺序去找同学做调查。

请你协助明明完成“去重”与“排序”的工作。

Input:有2行,第1行为1个正整数,表示所生成的随机数的个数:N;第2行有N个用空格隔开的正整数,为所产生的随机数。

Output:也是2行,第1行为1个正整数M,表示不相同的随机数的个数。

宁波大学913大学物理(光、电两部分)2018年考研初试专业课真题试卷

宁波大学913大学物理(光、电两部分)2018年考研初试专业课真题试卷

B dL 0 I i 中, Ii 是指
L


_________________________________; 由_________________________决定的。
B 是指_________________________________,它是
6、在自感系数 L = 0.05 mH 的线圈中,流过 I = 0.8 A 的电流。在切断电路后经过 t = 100 s 的时 间,电流强度近似变为零,回路中产生的平均自感电动势为____________________。 7、在杨氏双缝干涉实验中,双缝与屏幕的距离为 1 m,双缝之间的距离为 0.2 mm。若第一级到 第四级明纹之间的距离为 7.5 mm,则入射光的波长为___________________; 若入射光的波长 改为 600 nm,则相邻两明纹的间距为___________________. 8、利用劈尖的等厚干涉条纹可以测量很小的角度。今在很薄的劈尖玻璃板上,垂直地射入波长 为 589.3 nm 的钠光,相邻暗条纹间距离为 5.0 mm,玻璃的折射率为 1.52,则此劈尖的夹角 为______________________。 9、波长为 = 550nm 的单色光垂直入射到光栅常数 d = 2× 10-4 cm 的平面衍射光栅上,则可能观 察到的光谱线的最大级次为___________________。 10、在水(折射率 n1= 1.33)和一种玻璃(折射率 n2 = 1.56)的交界面上,自然光从水中射向玻 璃,则起偏角为_____________________。若自然光从玻璃中射向水,则此时的起偏角
第 1 页 共 3 页
宁波大学 2018 年硕士研究生招生考试初试试题(A 卷)
(答案必须写在考点提供的答题纸上)

2018年宁波大学3810数字集成电路设计基础博士研究生初试试卷(A卷)

2018年宁波大学3810数字集成电路设计基础博士研究生初试试卷(A卷)

科目代码: 3810 科目名称:数字集成电路设计基础VDDGND IN1IN2IN3IN4OUT科目代码: 3810 科目名称:数字集成电路设计基础科目代码: 3810 科目名称:数字集成电路设计基础5.说明如图5所示的静态CMOS反相器的总功耗由哪几部分组成,并列出每一项功耗的具体表达式。

(10分)pmosnmosVDDC L图5. 静态CMOS反相器6.分析图6所示的电路,在不同时钟CLK输入下Q0、Q1、Q2与Q3的输出状态,并将状态量填入表1。

假设各个D触发器的初始输出状态皆为Q=0。

(10分)图6.D触发器构成的时序逻辑电路表1.电路输出状态表CLK的顺序输入D1 Q0Q1Q2Q30 0 0 0 0 01 12 03 14 15 0科目代码: 3810 科目名称:数字集成电路设计基础7.试用差分串联电压开关逻辑(DCVSL)与互补传输管逻辑(CPL)实现二输入的XOR/NXOR逻辑门,要求画出其晶体管级电路图。

(10分)8.在图7所示电路中,已知CMOS集成施密特触发器的电源电压V DD=15V, V T+=10V,V T-=5V,R=100KΩ, C=10μF。

试画出u c和u0的波形,并求出u0的频率以及占空比。

(10分)图7. 施密特触发器电路9.叙述图8所示的单管动态CMOS存储单元读与写的工作原理与工作过程。

(8分)T C1C2图8. 单管动态CMOS存储单元10.试回答下列问题:(1)在标准CMOS工艺中,NMOS衬底(阱)通常与电路中最低电位相接,若NMOS衬底(阱)与最高电位相接,会产生什么害处? (4分)(2)MOS管有三种主要漏电流(4分)(3)试分别说明: 在65nm以下工艺,哪两种漏电流起主要作用?(4分)。

宁波大学2018年《912信号与系统》考研专业课真题试卷

宁波大学2018年《912信号与系统》考研专业课真题试卷

n
1 2
n
(4)当输入 x(n) = 2 + cos n u(n) 时,求系统的稳态响应。

π 4
第 3 页 共 3 页
x(t) 1 -2 O -1 2 4 6 8 t
h(t) 2 -1 O 1 2 3 t
题 3.1 图 (2)试计算卷积和 y[n]= x[n]* h[n],其中 x[n]={1, 2, 0, 3, 2}(n=-3, -2,-1,0, 1),h[n]={1, 4, 3}(n=-1, 0, 1)。 4.(12 分)试画出信号 f (t ) = sgn{sin[ 叶级数表示式。 5.(14 分)求信号 f (t ) =

2
(t − 1)]} 的波形,并求出该信号的指数函数形式傅里
sin(2t ) cos(5t ) 的傅里叶变换 F ( j) ,并画出其频谱图。 t
6. (18 分)某系统如题 6 图所示,输入 f1(t)为带限信号,H(jω)为带通滤波器。 (1)当 2 = 21 , a = 1 , b = 2 , T =
总分值:
150
科目名称:
信号与系统
f1(t) p(t)
fs(t)
H(j)
f2(t) -2 -1
F1(j) 1 O A
1
H(j)
2
p(t) (1) ... -2T -T O ... T 2T 3T 4T 5T t -b -a O
a
b
题6图 7.(14 分)已知系统函数 H (s) 的极点位于 s = −3 处,零点在 s = −a 且 H () = 1 。此系统的阶 跃响应中包含一项 K1e
−3t
。若 a 从 0 变到 5,确定相应的 K1 值如何随之改变。
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

B)int a[10]={};
C)int a[]=(0);
D)int a[10]={10*1};
14、定义如下变量和数组:
int k;
int a[3][3]={1,2,3,4,k=0;k<3;k++) printf(“%d”,a[k][2-k]);

A)do{i=1; s=1;
B)do{i=1; s=0;
s=s*i;
s=s*i;
i++;
i++;
}while(i<=10);
}while(i<=10);
C)i=1; s=1;
D)i=1; s=0;
do{s=s*i;
do{s=s*i;
i++;
i++;
}while(i<=10);
}while(i<=10);
#include<stdio.h>
void main( )
{ int x=1,a=0,b=0;
switch (x)
{ case 0: b++;
case 1: a++;
case 2: a++; b++;
}
printf("a=%d, b=%d\n",a,b);
}
A) a=2, b=1 B) a=1, b=1
11、下面有关 for 循环的正确描述是

A) for 循环只能用于循环次数已经确定的情况
B) for 循环是先执行循环体语句,后判断表达式
C) 在 for 循环中,不能用 break 语句跳出循环体
D)for 循环的循环体语句中,可以包含多条语句,但必须用花括号括起来
12、如下程序的输出结果是 _ 。
B) for(i=0;i<6;i++) printf("%2d",*(p+i));
C) for(i=0;i<6;i++) printf("%2d",*p++);
D) for(i=0;i<6;i++) printf("%2d",(*p)++);
3、以下不正确的叙述是

A)在 C 程序中,逗号运算符的优先级最低
B)在 C 程序中,APH 和 aph 是两个不同的变量
C)若 a 和 b 类型相同,在执行了赋值表达式 a=b 后 b 中的值将放入 a 中而 b 中的值不变
D)当从键盘输入数据时,对于整型变量只能输入整型数值,对于实型变量只能输入包含小数
点的实型数值
4、设 x、y 和 z 是 int 型变量,且 x=3,y=4,z=5,则下面表达式中值为 0 的是
B) 3.64
C) 4.14
D) 6.78
7、将 s 所指节点加到 p 所指节点之后(如下图), 其语句应为:

A) s->next = p+1; p->next = s;
B) p->next = s; s->next = p->next;
C) s->next = p->next; p->next = s->next;
A)3 5 7 B)3 6 9 C)1 5 9
D)1 4 7
15、判断字符串 a 和 b 是否相等,应当使用

A)if(a==b)
B)if(a=b)
C)if(strcpy(a,b))
D)if(strcmp(a,b)==0)

A)‘x’&&‘y’
B)x<=y
C)x||y+z&&y-z
D)!((x<y)&&!z||1)
5、对于 int x, y; 语句 if (x<0) y= -1; else if (!x) y=0; else y=1; 等价于 。
A) y=0; if (x>=0) if (x) y=1; else y= -1;
(答案必须写在考点提供的答题纸上)
科目代码:
914
适用专业:
科目名称:
计算机技术
C 程序设计
6、若有以下宏定义
#define PI
3.14
#define ADDPI (PI+1)
#define TWO_ADDPI (2*ADDPI)
则程序中表达式 x=TWO_ADDPI/2 的值为 。
A) 6.28
D) s->next = p->next; p->next = s;
8、对于以下递归函数 f, 调用 f(4),其返回值为:

int f(int n)
{ return f(n-1)+n; }
A) 10
B) 11
C) 0
D) 以上均不是
9、设有程序段,则下面描述中正确的是

int k=10;
while(k=0) k=k-1;
C) a=1, b=0
D) a=2, b=2
第 3 页 共 10 页
宁波大学 2017 年硕士研究生招生考试初试试题(A 卷)
(答案必须写在考点提供的答题纸上)
科目代码:
914
适用专业:
科目名称:
计算机技术
C 程序设计
13、以下能对一维数组 a 进行正确初始化的语句是

A)int a[10]=(0,0,0,0,0);

A) ‘0’<=c<=‘9’
B) ‘0’<=c && c<=‘9’
C) ‘0’<=c || c<= ‘9’ D)以上均不是
2、设有定义语句:int x[6]={2,4,6,8,5,7},*p=x,i; 要求依次输出 x 数组 6 个元素中的值,不
能完成此操作的语句是

A) for(i=0;i<6;i++) printf("%2d",*(p++));
宁波大学 2017 年硕士研究生招生考试初试试题(A 卷)
(答案必须写在考点提供的答题纸上)
科目代码:
914
适用专业:
科目名称:
计算机技术
C 程序设计
一、 单项选择题:本大题共 25 小题,每小题 3 分,共 75 分。
1、判断字符变量 c 的值为数字(‘0’--‘9’)则返回 1,否则返回 0,可用表达式:
A)while 循环执行 10 次
B)循环是无限循环
C)循环体语句一次也不执行
D)循环体语句执行一次
第 2 页 共 10 页
宁波大学 2017 年硕士研究生招生考试初试试题(A 卷)
(答案必须写在考点提供的答题纸上)
科目代码:
914
适用专业:
科目名称:
计算机技术
C 程序设计
10、以下能正确计算 1×2×3×…×10 的程序段是
B) if (x!=0) if (x>0) y=1; else y= -1; else y=0;
C) if (x<0) y= -1; if (x!=0) y=1; else y=0;
D) y= -1; if (x!=0) if (x>0) y=1; else y=0;
第 1 页 共 10 页
宁波大学 2017 年硕士研究生招生考试初试试题(A 卷)
相关文档
最新文档