vc2013模拟试题参考答案

合集下载

江苏计算机二级考试+Visual+C++上机真题一2013年春季

江苏计算机二级考试+Visual+C++上机真题一2013年春季

江苏计算机二级考试 Visual C++上机真题一2013年春季(总分:2.00,做题时间:70分钟)1.改错题【题目】如果将一个二进制数的各位数字的顺序颠倒后所得到的新二进制数与原数相等,则称该二进制数为回文数,以下程序的功能是:在由两个正整数确定的范围内,查找对应的二进制数为回文数的整数,采用的算法是:将待判断的整数转换为二进制数形式,并按正序和反序方式分别存入两个字符串中,比较两个字符串,若两个字符串相等则该数为符合要求的数正确程序的输入/输出结果如下(下划线部分为键盘输入): 请输入查找范围:100 200 对应的二进制数为回文数的个数为:8 107à1101011 119à1110111127à1111111 129à10000001 153à10011001 165à10100101 189à10111101 195à11000011 含有错误的源程序如下#include #include char *fun(int t) { char s1[33]={0},s2[33]={0},c,*p1,*p2; p1=s1;p2=s2+31; while(t){ c=t%2; t/=2; *p1++=c; *p2++=c; } p2++; if(!strcmp(s1,p2)){ char *p=new char[33]; strcpy(p,s1); return *p; } else return 0; } void main() { int a[200]={0},low,up; char*bin[200]={0},*p; cout<<"请输入查找范围:"; cin>>low>>up; for(int i=0,j=low;j<=up;j++)if(p==fun(j)){ a[i]=j; bin[i++]=p; } cout<<"对应的二进制数为回文数的个数为:"<<i<<<a[i]<<"-->"<<bin[i]<(分数:1.00)__________________________________________________________________________________________ 正确答案:()解析:2.编程题(20分) 【题目】试定义一个类STR,统计一个字符串中包含的句子数和单词数,规定单词之间以空格、”,”或”.”分隔,句子以”.”结束,具体要求如下 (1)私有数据成员 char *s :指向待统计的字符串 int m,n: 分别记录求得的单词数和句子数 (2)公有成员函数 STR(char *t): 构造函数,用参数t初始化字符串s void fun(): 按题意统计单词数,结果存放在数据成员m中,再统计句子数,结果存放在数据成员n中 void print(): 按输出示例的格式输出统计结果 ~STR(): 析构函数,实现必要的功能 (3)在主函数中对该类进行测试输出示例: 字符串:I am a student. I am twenty. I com from china 句子数:3 单词数:11 【要求】源程序文件名必须为myfb.cpp,并放在T盘根目录下,供阅卷用(分数:1.00)__________________________________________________________________________________________ 正确答案:()解析:。

2013年新版C语言习题答案1-7章

2013年新版C语言习题答案1-7章

习题答案习题1(参考答案)1.计算的本质是什么?计算的本质就是基于规则的符号串变换。

2.三大科学思维是指什么?理论思维、实验思维、计算思维3.什么是计算思维?计算思维的基本特征有哪些?计算思维是指运用计算机科学的思想、方法和技术进行问题求解、系统设计,以及人类行为理解等涵盖计算机科学之广度的一系列思维活动。

从计算科学的角度分析,计算思维包括6个方面的特征:抽象性、数字化、构造性、系统化、虚拟化和网络化。

4.什么是算法?算法的基本特征有哪些?算法(Algorithm)是在有限步骤内求解某一问题所使用的一组定义明确的规则。

通俗地讲,就是计算机解题的步骤。

一个算法应该具有以下五个重要特征。

(1)有穷性:一个算法必须保证执行有限步之后结束。

(2)确定性:算法的每一步骤必须有确定的定义。

(3)输入:一个算法有0个或多个输入,以刻画运算对象的初始情况。

0个输入是指算法本身给定了初始条件。

(4)输出:一个算法有一个或多个输出,以反映对输入数据加工后的结果。

(5)可行性:算法上描述的操作在计算机上都是可以实现的。

5.算法的复杂度分为哪两种?算法的复杂性用复杂度来说明,分为时间复杂度和空间复杂度。

时间复杂度:执行该算法所需要的计算工作量,一般用所需基本运算的执行次数来度量。

空间复杂度:执行该算法所需的内存空间,一般用算法程序本身占的空间+输入的初始数据占的空间+算法执行过程中所需的额外空间的总和来表示。

6.什么是程序?程序与算法的区别是什么程序是为了实现特定目标或解决特定问题而用计算机语言编写的指令序列,它由算法和数据结构组成。

算法与程序的区别:计算机程序是算法的一个实例,同一个算法可以用不同的计算机语言来表达。

7.简述程序设计语言发展的过程。

计算机程序设计语言从最初的机器代码到今天接近自然语言的表达,经过了四代演变。

一般认为机器语言是第一代,符号语言即汇编语言为第二代,面向过程的高级语言为第三代,面向对象的高级语言为第四代。

vc性格测试题及答案

vc性格测试题及答案

vc性格测试题及答案一、单选题(每题2分,共10分)1. 你更倾向于以下哪种工作方式?A. 独立完成任务B. 团队合作C. 领导他人D. 跟随他人答案:A2. 当面对困难时,你通常如何反应?A. 积极寻找解决方案B. 寻求他人帮助C. 等待问题自行解决D. 放弃答案:A3. 你更喜欢哪种沟通方式?A. 直接而坦率B. 委婉而含蓄C. 幽默而风趣D. 严肃而正式答案:A4. 在社交场合中,你通常:A. 主动与人交流B. 等待他人接近C. 喜欢独自观察D. 避免社交答案:A5. 当你的观点与他人不同时,你会:A. 坚持己见B. 尝试理解对方C. 避免冲突D. 妥协答案:A二、多选题(每题3分,共15分)6. 以下哪些描述符合你的性格特点?A. 善于分析B. 富有同情心C. 喜欢冒险D. 追求完美答案:A、B、C、D7. 在团队中,你通常扮演哪种角色?A. 领导者B. 协调者C. 执行者D. 创新者答案:A、B、C、D8. 你更倾向于以下哪种学习方式?A. 自主学习B. 集体讨论C. 实践操作D. 理论学习答案:A、B、C、D9. 以下哪些是你在决策时考虑的因素?A. 逻辑分析B. 他人意见C. 直觉感受D. 风险评估答案:A、B、C、D10. 你更倾向于以下哪种解决问题的方法?A. 系统分析B. 随机应变C. 创新思维D. 传统方法答案:A、B、C、D三、判断题(每题1分,共10分)11. 你通常在压力下表现更好。

()答案:正确12. 你更倾向于遵循既定的规则和程序。

()答案:错误13. 你经常能够看到问题的多个方面。

()答案:正确14. 你更喜欢在熟悉的环境中工作。

()答案:错误15. 你通常能够快速适应新环境。

()答案:正确16. 你更倾向于在团队中担任领导角色。

()答案:正确17. 你更喜欢有明确目标和计划的工作。

()答案:错误18. 你通常能够很好地控制自己的情绪。

()答案:正确19. 你更喜欢独立工作,而不是团队合作。

2013年全国大学生英语竞赛C类真题及答案

2013年全国大学生英语竞赛C类真题及答案

2013 National English Contest for College Students(Level C - Preliminary)(总分:150分答题时间:120分钟)Part I Listening Comprehension (30 marks)Section A (5 marks)In this section, you will hear five short conversations. Each conversation will be read only once. At the end of each conversation, there will be a twenty-second pause. During the pause, read the question and the three choices marked A, B and C, and decide which is the best answer. Then mark the corresponding letter on the answer sheet with a single line through the center.1.Why didn’t the man go to see Macbeth last week?A.He didn’t manage to get a ticket.B.He had to attend a conference.C.He had a better production to watch.2.What does “Fill Me In” refer to in this conversation?A. A type of upgraded mobile phone.B. A well-selling magazine.C. A writer’s new book series.3.Why doesn’t the woman like the bag?A.She doesn’t like the pattern.B.It’s not easy to carry.C.It’s too big for her.4.What makes a bad CV according to the man?A.Fake information.B. Terrible writing.C. Undesirable length.5.How will Cathy continue her Spanish learning?A.She’s going to make a friend in Spain.B.She’ll communicate with a Spanish friend in Spain.C.She’ll practice speaking Spanish with an English friend.Section B (10 marks)In this section, you will hear two long conversation. Each conversation will be read only once. At the end of each conversation, there will be a one-minute pause. During the pause, read the question and the three choices marked A, B and C, and decide which is the best answer. Then mark the corresponding letter on the answer sheet with a single line through the center.Conversation One6.What traffic accident are the speakers talking about?A. A kid was knocked down by a car.B.Two cars crashed into a shop.C. A car ran into a wrong place.7.Why did the accident happen according the woman?A.There were many shops around.B.The crossing is in a wrong place.C.There was no crossing here.8.Which of the following is the suggestion they made?A.More traffic lights should be installed.B. A speed camera should be mounted.C.More policemen should patrol that area.9.Where, as the woman mentioned, has got improved traffic?A.Her own neighborhood.B.Her big brother’s neighborhood.C.Her parents’ neighborhood.10.How was the man punished for his traffic offence?A.He was fined 100 pounds with extra penalty points.B.He had to pay 150 pounds and got 6 penalty points.C.He finally paid 600 pounds without any penalty points.Conversation Two11.Why is the expert opposed to the view that memory aids make your memory worse?A.There is no evidence showing that memory aids are invalid.B.Human beings’ brain functions mainly through memory aids in an effective way.C.Memory aids encourage an organized approach which helps the brain functioneffectively.12.What is interview’s attitude towards the idea that visual image help the memoryA.It is hard to believe.B.It is nothing strange.C.It is obviously nonsense.13.Who developed the system of memory aids centuries ago?A.Inhabitants on an isolated island.B.The Ancient Greeks.C. A great psychologists.14.How does mapping out notes affect the brain?A.It is helpful in reflecting the way people link information in the brain.B.It prevents people from arranging things logically.C.It makes people’s brain function t he opposite way.15.What tends to affect people’s ability to think clearly?A.Upbringing and innate differences.B.Worry and anxiety.C.Their aptitudes.Section C (5 marks)In this section, you will hear five short news items. After each item, which will be read only once, there will be a pause. During the pause, read the question and the three choices marked A, B andC, and decide which is the best answer. Then mark the corresponding letter on the answer sheet with a single line through the center.16.How can social media influence the presidential election in the USA according to thelatest research?A.It can help voters to choose their president.B.It can help to ensure the fairness of the elections.C.It can help to increase the number of voters.17.What honorary title has Yaya Toure been granted?A.The African Player of the Year.B.212 Star of the Confederation of African Football.C.The Ivory Coast star.18.Why did Reshma Saujani set up the organization “Girls Who Code”?A.To raise women’s status in the field of science.B.To improve girls’ aptitude and performance in STEM.C.To arouse girls’ interest in science and technology.19.Which tablet computer’s hardware inside is more powerful?A.The CNET Kum.B. The Google Nexus 7.C. The Apple iPad mini.20.What does the company announce that it can do for the United States?A.It can reduce the amount of plastic waste.B.It can help to recycle the plastic waste.C.It can increase the amount of exports.Section D (10 marks)In this section, you will hear a short passage. There are 10 missing words or phrases. Fill in the blanks with the exact words or phrases you hear. The passage will be read twice. Remember to write the answers on the answer sheet.If you (21) ____ smooth skin that glows with youth, the chances are that at some point you will have heard the exhortation to drink lots of water in order to (22) ____ those evil toxins and keep your skin healthy.The exact amount people suggest varies. US – based advice (23) ____ eight glasses a day, while in hotter climates people are advised to drink to more to (24) ____ higher rates of sweating. But regardless of the exact volume of water suggested, the principle behind the advice remains the same --- taking extra water on board will keep your skin hydrated. In other words, water acts like a moisturizer, but from the inside out.This is such a common idea you might be surprised at the (25) ____ to back up. You might expect there to be countless studies where people are (26) ____ two groups, one assigned to sip water all day, the other to drink a normal amount. Then the smoothness of the skin could be (27) ____ a month or so later to establish whether sipping more lead to smoother skin.In fact such studies are rare, partly because water can’t be patented, so it is hard to find anyone to fund such research when there will be no new (28) ____ or cosmetic to sell that could repay the costs. A review by the dermatologist Ronni Wolf at the Kaplan Medical Center in Israel found just one study looking at the effect of long-term water intake on the skin. But the resultswere (29) ____. After four weeks, the group who drank mineral water showed a decrease in skin density, which some believe suggests the skin is retaining more moisture, while those who drank tap water showed an increase in skin density. But regardless of the type of water they drank, it made no difference to their (30) ____ or to the smoothness of their skin.Part II Vocabulary and Structure (15 marks)There are 15 incomplete sentences in this section. For each blank there are four choices marked A, B, C and D. Choose the one that best completes the sentence. Then mark the corresponding letter on the answer sheet with a single line through the center.31. The new star said to the journalists that she _C___ the opportunity to show that she could playa serious film role.A. greetedB. rejoicedC. welcomedD. cheered32. We haven’t really __D__ a solution to the problem yet, which makes the boss really frustrated.A. built upB. fallen back onC. brought overD. come up with33. Personally, I am __C__ banning cigarette smoking completely, especially in public areas.A. in touch withB. apart fromC. in favor ofD. regardless of34. Until a firm agreement has been reached, I am not __C__ to accepting the offer.A. accustomedB. dedicatedC. committedD. entitled35. The government is making every effort to __B__ an economic crisis, but it seems nothing could help.A. eliminateB. avertC. impedeD. swerve36. __B__ a serious crime, what exactly should you do?A. Unless you witnessB. If you were to witnessC. If only you witnessD. since you witness37. During examinations candidates are always supposed to stay in seats, keep their eyes on the work, _A___ to anyone.A. and not speakB. but could not speakC. rather than speakD. instead of speaking38. Realizing that he hadn’t got enough money and _D___ to borrow any from his parents, he decided to sell his house.A. wanted notB. not to wantC. wanting notD. not wanting39. There’s no point waiting here any longer. We _C___ go and have something to eat.A. can hardlyB. are bound toC. might as wellD. will have to40. While many people may refer to up-to-minute news, it is unlikely that television and the Internet _A___ the newspapers completely.A. will replaceB. replaceC. are replacingD. have replaced41. She married a very nice young architect from Belfast, _A___ she met on a bus during her journey to Northern Ireland.A. whoB. whenC. whichD. where42. It is a kind of illness that can result in total blindness if __D__A. to leave untreatedB. is left untreatedC. leaving untreatedD. left untreated43. ----I’m so disappointed with my son! He just wouldn’t practice the piano!----Take it easy. You can lead ___B_ to water, but you can’t make it drink.A. a duckB. a horseC. a cowD. a dog44. ----Good morning, Madam! I’d like some information about the course.----Certainly. _B___A.I’m afraid I don’t know more than you either.B.Is there anything I can do for you?C.What exactly would you like to know?D.How much information did you know?45. ---- How do you feel about countries that don’t try to reduce global warming?---- __A__, those countries care more about money than saving the planet.A.As far as I’m concernedB. It’s none of ou r businessC. We’re not to blameD. Things are under controlPart III Cloze (10 marks)Read the following passage and fill in each blank with one word. Choose the correct word in one of the following three ways: according to the context, by using the correct form of the given word, or by using the given letters of the word. Remember to write the answers on the answer sheet.According to recent surveys, 72% of all Americans believe that the United States government is (46) hiding____ information about UFOs. Almost 68% of people think that the government has secret knowledge of extraterrestrial life. It is not (47) _surprising__ (surprise) that the government has come under more and more (48) pressure____ to declassify its UFO records and make them public. A variety of different groups have been involved in these efforts.One group to become involved is called CFI, the Coalition for Freedom of Information, John Podesta, who was White House Chief of Staff during Bill Clinton’s (49)presidency____(president), is one of the many high-powered people active in this group. CFI’s aim is not to prove the (50) _existence___(exist) of extraterrestrial life, but to make it easier for scientists in general to study unexplained aerial phenomena. Podesta and his group has asked the Pentagon to declassify its UFO records and therefore provide scientists (51) with____ data that will help in the study of UFOs.CFI has requested the release of information on several UFO cases, starting with the Kecksburg, Pennsylvania, incident. This incident took (52) __place__ in 1965 when a large acorn-shaped object, the size of a small car, crashed in Pennsylvania. Some analysts say it could have been the spacecraft Kosmos 96 that had been launched towards Venus by the Soviet Union, but failed to escape Earth’s (53) gravity____. Others say the object did not look anything like spacecraft built on Earth in 1965.(54) Additionally___, the people of Kecksburg want to know what happened. On that (55) afternoon____, hundreds of eyewitnesses watched a fiery streak of light descend from the sky towards Earth. Officials explained that nothing was found or recovered and that maybe the fireball in the sky was a meteor. But many witnesses say they saw a number of military personnel from the Army and the Air Force search the woods, and later that evening, saw a large militarytractor-trailer coming from the area carrying a large object under a tarp.Part IV Reading Comprehension (40 marks)Read the following passage. Each passage is followed by several questions. Respond to the questions using information from the passage. Remember to write the answers on the answer sheet.Section A (10 marks)Questions 56-60 are based on the following passage.The average automatic teller machine (ATM) is not very smart. It will give money to anyone who has the right card and punches four or five keys in the right order. Some analysts estimate that as many as 30% of ATM transaction worldwide are cases of theft. To increase security at cash machines, some banks have tried to make their ATMs a little smarter. A small camera on the machine looks directly into the eye of every customer. It scans one iris and compares the tiny patterns of ridges, dots, and other features to a code in its computer. If there is a match, the ATM will start counting out cash. If not, a message is automatically sent to the nearest police station.Iris-scanning is one fast-growing form of biometric identification --- determining who someone is by examining features the body. One of the earliest biometric techniques was fingerprinting. The line on fingerprints are unique to each person, so not even identical twins have the same fingerprints. Fingerprinting has become famous as a way of finding out who committed a crime, but it very often fails. A careful criminal can swear gloves, avoid touching thing, or even alter his fingerprints by burning, cutting, or scraping them. In the search for a more reliable system, security experts have focused on the eye.Like a fingerprint, every iris is, for all practical purposes, unique. Each person’s right iris is even different from his or her left one. A low-cost digital camera, like the kind installed at ATM machines, can easily detect hundreds of different features in the iris. The chance of two irises having the same features is close to zero. Tests have shown that iris-scanners are very hard to fool. They can tell the difference between a real iris and a false one. They can see right through colored contact lenses, eyeglasses, and even mirrored sunglasses. Although many criminal are willing to burn or cut their fingers in pursuit of the perfect crime, few would be willing or able to alter their irises.T o make iris-scanning work, a computerized database has to match certain iris features with certain people. This means that each A TM customer has to allow a bank to photograph his or her iris and keep that highly personal information in a computer. Some people have worried, however, that an increased use of iris-scanning will lead to a dangerous loss of privacy. By mountingiris-scan cameras in public places, governments could track a private citizen all day long without the person’s knowledge. This would be a great advantage to the police, but it could also give corrupt officials a new way to control their opponents. The military’s development of tiny robots suggests that government iris-scanners could even invade private homes!Questions 56-60Complete the summary with words from the passage, changing the form where necessary, with only one word for each blank.Section B (10 marks)Questions 61-65 are based on the following passage.Seed catalogues feature hundreds of flowering species. For the persons just beginning garden this can be bewildering, and below are the details of some popular choices, nearly all of which should be sown in the spring. With the exception of busy lizzies, which need a little care, they are all very easy to grow from seed.DahliasThese are sturdy plants bearing showy flowers in a wide range of rather gaudy colors. Sow in a frame in April and plant the seedlings out when frosts are over. Dahlias flower throughout the summer and into the autumn. When autumn frosts begin to make them look unhappy, you should dig up the tuberous roots and save them. A frost -free loft, shed or garage is the ideal place. The following spring you plant the tubers instead of sowing seed again.LupinsLupins are hardy perennials. This means that the plants will stay in your garden and carry on flowering year after year. Seed sown in April will usually give you some spikes of colors in the first summer, and year by year the plants get bigger and the flowering stems get taller and grander. Selective breeding has led to the introduction of some fine, bicolored varieties in some dazzling shades. The short -lived flowers make a real misunderstanding spectacle.Busy lizziesLike dahlias, busy lizzies need to be started offunder glass, as they cannot stand frost, and pantingout is best done in May. Outdoor flowering ends inSeptember, so beat the frosts and bring your favoritespecimens indoors to give your home some sintercolor! Indoors they will carry on floweringindefinitely, though you may like to plant them outagain when spring returns. Like pansies (below) they do very well in sun or shade, but the soil must be moist. Most varieties grow to be a height of only 20 cm or so.PotentillasPotentillas are hardy shrubs. In other words, the woody branches spring from groundlevel—there is no central trunk. Seed is probably best sown in autumn, in which case you should keep the plants in a sheltered spot until April offers favorable conditions for planting out. Once flowering begins in early summer the best varieties (such as Melton Fire) will stay in bloomATM transactions are often cases of theft, where an unauthorized user takes (56) __money_. To decrease insecurity, some banks have installed iris -scanning machines at ATMs. These small cameras scan the user’s iris, recording its features and (57) _comping___ them to a digital file. Every person has a (58) _ unique ___ iris, making iris identification highly reliable. Earlier efforts at biometric identification often relied on fingerprints. However, fingerprints can easily be (59) altered____ through cutting, burning or scrapping. Iris scanners are so effective that they can even see through contact lenses and mirrored sunglasses. Use of iris scanners would provide great advantages to the police. However, others worry about a loss of (60) ____.almost ceaselessly for years on end while at the same time spreading out to provide ground cover or a low hedge.PansiesPansies have a good long flowering season year after year, and some varieties can be sown in spring to give truly splendid results the first autumn. Unlike dahlias and lupins, which can easily grow a meter tall, pansies grow no higher than 10 or 20 cm. Their soil, position and moisture requirements are just like those of busy lizzies but pansies differ in being hardy. Give them a try!Questions 61-63Decide whether the following statements are true (T) or false (F) according to the passage.61. Both dahlias and lupins, which are sown in April, need protecting from frost.62. Brought indoors in autumn, dahlias, busy lizzies and potentillas will carry on flowering almost non-stop.63. Among all the flowers busy lizzies are not very easy to grow from seed.Section C (10 marks)Questions 66-70 are based on the following passage.When looking for love, people may go to some extreme lengths. They might go on blind dates set up by family and friends. They might write personal ads to place in newspapers. Or they might use a computer to help them in their search for a soul mate by joining an online dating services. Some people have even tried to find their perfect match through game shows on television. Many of these TV dating shows, including The Bachelor and Who Wants to Marry a Millionaire? have proved to be ratings blockbusters, with millions of viewers watching each week to find out which of the contestants will find true love.Of all these game shows, perhaps the one with the most unexpected ending was Mr. Right, which was shown in England in 2002. On the show, a bachelor, thirty-five-year-old Lance Gerrard-Wright, dated fifteen women to find the one who was his ideal partner. The host of the show was Ulrika Johnson, an English celerity originally from Sweden. For seven weeks on the show, Gerrard-Wright took turns going on dates with each of the women, taking them to expensive restaurants and exotic locations. He even met the women’s families and introduced them to his own. Then at the end of each episode, he would choose between one and three of the contestants with whom he had felt the least compatible, and say goodbye to them.At one point during the series, one contestant volunteered to leave because she said she didn’t find him attractive. After two dates she said she had had enough, and she couldn’t see it working. “He wasn’t my cup of tea.” In another episode the woman he was on a date with burst into tears when he called her by another contestant’s name. “You called me by another girl’s name. I can’t believe you did that. I really liked you,” she sobbed.But in the final episode, the woman he eventually chose decided she didn’t want to marry him after all. “I think you’ve chosen me because you have to choose someone,” she said. Maybe this was because she already knew he had fallen in love---with the show’s host!After leaving the show, Gerrard-Wright and Johnson were seen dining together and attending parties around London more and more often. Finally, on May 1, 2003, Gerrard-Wright proposed to Johnson on the steps of St. Paul’s Cathedral. And she accepted his proposal right away, although it was a conditional acceptance. Johnson has two children from previous relationships—aneight-year-old son, Cameron, and a two-year-old daughter, Bo. She had to make sure that they agreed to the marriage. Luckily, they did. Gerrard-Wright said, “In the end the show did work for me. I grabbed an opportunity to get a girlfriend and I did. Ulrika’s gorgeous.”Questions 66-68Complete the following sentences with information given in the passage in a maximum of 2 words for each blank.66. Lance Gerrard-Wright went to ____ to go on the show Mr. Right in order to find his perfect match.67. On the show, Lance had the opportunity to date many gorgeous women among whom there might be one that he was almost ____.68. Ulrika accepted Lance’s proposal ____ that her children agreed to their marriage as well. Questions 69-70Choose the best answer according to the passage.69. Which of the following did NOT happen on the show?A. Lance went on dates with several women.B. The candidates went to some very good restaurants.C. Ulrika consulted her parents before she made her decision.D. The women met Lance’s family.70. What happened after seven weeks of doing the show?A. All of the women found their beloved.B. Lance started to date with the show’s host.C. One of the women on the show couldn’t help crying.D. Ulrika asked Lance to marry her.Section D (10 marks)Questions 71-75 are based on the following passage.Alaska is disappearing slowly but surely. Since the 1950s, it is estimated that as much as 15 percent of Alaska’s area has disappeared. But how can a whole state be disappearing?One reason for Alaska’s gradual disappearance is the melting its glaciers. According to one geologist at the US Geological Survey, about 98 percent of Alaska’s glaciers are either unmoving or diminishing. This diminishing seems mainly due to the increase in global temperatures. Since the 1960s, the average year-round temperature has increased by 5℉. Furthermore, the average winter temperature has increased by 8℉. Presently, an estimated 24 cubic miles of ice is disappearing from Alaskan glaciers every year. It may be even more in the near future, as some scientists predict that the average world temperature could go up 2.5 to 10℉by the year 2010.Another problem contributing to Alaska’s gradual disappearance is its permafrost. (74) Much of the land in Alaska was permanently frozen, or frozen for most of the year, thus maintaining its integrity. Now, the thawing permafrost is causing a number of problems on land. Roads and utility poles are collapsing. Also, the hard permafrost which originally prevented beaches from eroding during violent storms is now melting. Affected villages are forced to relocate. For villages on small low islands, one terrible storm could wipe out the entire community.The melting permafrost and increasing temperature are also having a negative impact on the forests of Alaska. As the permafrost under the forests melts, insects that normally don’t turn upuntil the warmer seasons are appearing sooner. The spruce-bark beetle, for example, is increasing in numbers as a result of global warming. It usually takes about two years for these beetles to grow and reproduce in a very cold weather. However, due to the increase in temperatures, spruce-bark beetles are damaging as many trees in one year as they previously damaged in two. At this rate, Alaska’s forest won’t survive the turn of the century.Some scientists believe that human activity is linked to a global increase in weather temperature. Whether the rising temperature are caused by human activity or natural changes, the fact remains that Alaska is warming. Some others argue that global warming may be a normal trend on the Earth’s temperature chart. (75) One theory argues that we are near the end of aso-called “Little Ice Age”, and the return of the glaciers is natural result of this cycle. Whether natural or produced by humans, there is little hope for the immediate future of glaciers as we know them. Horribly, this could be a preview of what will happen to the rest of the world in the next century.Questions 71-73Answer the following questions briefly according to the passage.71. What are disappearing in Alaska actually?72. How much ice is melting each year according to the survey?73. Why do insects damage more trees than before?Questions 74-75Translate the underlined sentences in the passage into Chinese.74. Much of the land in Alaska was permanently frozen, or frozen for most of the year, thus maintaining its integrity75. One theory argues that we are near the end of a so-called “Little Ice Age”, and the return of the glaciers is natural result of this cycle. Whether natural or produced by humans, there is little hope for the immediate future of glaciers as we know them.Part V Translation (10 marks)Translate the following sentences into English, using the hints given in brackets. Remember to write the answers on the answer sheet.76. 宴会时间就要到了,但她仍纠结于是否应该去。

VC 复习题+答案

VC 复习题+答案

《VC程序设计》试卷1一、单项选择题(每小题1分,共20分)1、假定MyClass为一个类,则执行“” MyClass a[3],*p[2];”语句时,自动调用该类构造函数的次数为()A、2B、3C、4D、52、对于类中定义的成员,其隐含访问权限为()A、protectedB、privateC、publicD、static3、一个类的友元函数或友元类能够通过成员操作符访问该类的()A、私有成员B、所有成员C、公用成员D、保护成员4、下面说法正确的是()A、构造函数可以重载,析构函数不能重载。

B、构造函数不能重载,析构函数可以重载。

C、构造函数可以重载,析构函数也可以重载。

D、构造函数和析构函数都不可以重载。

5、下列语句的运行结果为()#include <iostream.h>srtuct COMPLEX{int x;int y;} cNum[2]={1,3,2,7};void main(){cout<< cNum[0].y*cNum[1] x<<endl;}A、3B、2C、21D、66、类AB的缺省构造函数和析构函数是()A、AB( )和~AB( )B、AB(int)和~AB( )C、AB( )和~AB(delete )D、AB( )和int~AB( )7、在C++中,若对函数未加说明,则函数的隐含类型是()A、intB、doubleC、voidD、char8、已知类A是类B的友元,类B是类C的友元,则( )A、类A一定是类C的友元B、类C一定是类A的友元C、类C的成员函数可以访问类B的对象的任何成员D、类A的成员函数可以访问类B的对象的任何成员9、下列说法中正确的是( )A、类定义中只能说明函数成员的函数头,不能定义函数体B、类中的函数成员可以在类体中定义,也可以在类体之外定义C、类中的函数成员在类体之外定义时必须要与类声明在同一文件中D、在类体之外定义的函数成员不能操作该类的私有数据成员10、以下不属于成员函数的是( )A、静态成员函数B、友元函数C、构造函数D、析构函数11、对于消息队列的描述正确的是()A、在Windows中只有一个消息系统,即系统消息队列。

2013年计算机二级C++模拟试题及答案(2)

2013年计算机二级C++模拟试题及答案(2)

⼀、选择题 1.已知⼀棵⼆叉树前序遍历和中序遍历分别为ABDEGCFH和DBGEACHF,则该⼆叉树的后序遍历为 A)GEDHFBCA B)DGEBHFCA C)ABCDEFGH D)ACBFEDHG 【参考答案】 B 2.树是结点的集合,它的根结点数⽬是 A)有且只有1 B)1或多于1 C)0或1 D)⾄少2 【参考答案】 A 3.如果进栈序列为e1,e2,e3,e4,则可能的出栈序列是 A)e3,e1,e4,e2 B)e2,e4,e3,e1 C)e3,e4,e1,e2 D)任意顺序 【参考答案】 B 4.在设计程序时,应采纳的原则之⼀是 A)不限制goto语句的使⽤ B)减少或取消注解⾏ C)程序越短越好 D)程序结构应有助于读者理解 【参考答案】 D 5.程序设计语⾔的基本成分是数据成分、运算成分、控制成分和 A)对象成分 B)变量成分 C)语句成分 D)传输成分 【参考答案】 D 6.下列叙述中,不属于软件需求规格说明书的作⽤的是 A)便于⽤户、开发⼈员进⾏理解和交流 B)反映出⽤户问题的结构,可以作为软件开发⼯作的基础和依据 C)作为确认测试和验收的依据 D)便于开发⼈员进⾏需求分析 【参考答案】 D 7.下列不属于软件⼯程的3个要素的是 A)⼯具 B)过程 C)⽅法 D)环境 【参考答案】 D 8.单个⽤户使⽤的数据视图的描述称为 A)外模式 B)概念模式 C)内模式 D)存储模式 【参考答案】 A 9.将E-R图转换到关系模式时,实体与联系都可以表⽰成 A)属性 B)关系 C)键 D)域 【参考答案】 B 10.SQL语⾔⼜称为 A)结构化定义语⾔ B)结构化控制语⾔ C)结构化查询语⾔ D)结构化操纵语⾔ 【参考答案】 C 11.下⾯关于类和对象的描述中,错误的是 A)类就是C语⾔中的结构体类型,对象就是C语⾔中的结构体变量 B)类和对象之间的关系是抽象和具体的关系 C)对象是类的实例,⼀个对象必须属于⼀个已知的类 D)类是具有共同⾏为的若⼲对象的统⼀描述体 【参考答案】 A 12.以下各选项组中,均是C++语⾔关键字的组是 A)public operator this B)shod string static C)it while >= D)private cout printf 【参考答案】 A 13.设int a=10,b=11,c=12;,表达式(a+b) A)2 B)0 C)-2 D)1 【参考答案】 B 14.下列描述正确的是 A)表⽰m>n为true或mn&&m B)switch语句结构中必须有default语句 C)if语句结构中必须有else语句 D)如果⾄少有⼀个操作数为true,则包含"||"运算符的表达式为true 【参考答案】 D 15.下列语句中不是死循环的是 A)int i=10; while (1) { i--; if(i==1)break; } B)for(int i=1;i<10;i++) { i--; } C)int i=0; do{ i++; }while(i>=0); D)int i=1; for(;;)i=i+1; 【参考答案】 A 16.下⾯关于break语句的描述中,不正确的是 A)break可以⽤于循环体内 B)break语句可以在for循环语句中出现多次 C)break语句可以在switch语句中出现多次 D)break语句可⽤于if条件判断语句内 【参考答案】 D 17.下⾯关于数组的描述错误的是 A)在C++语⾔中数组的名字就是指向该数组第⼀个元素的指针 B)长度为n的数组,下标的范围是0~n-1 C)数组的⼤⼩必须在编译时确定 D)数组只能通过值参数和引⽤参数两种⽅式传递给函数 【参考答案】 D 18.下⾯程序错误的语句是 ① #include ② void main() ③ { ④ int *p=new int[1]; ⑤ p=9; ⑥ cout < ⑦ delete []p; ⑧ } A)④ B)⑤ C)⑥ D)⑦ 【参考答案】 B 19.下⾯的哪个选项不能作为函数的返回类型? A)void B)int C)new D)long 【参考答案】 C 20.不能作为重载函数的调⽤的依据是 A)参数个数 B)参数类型 C)函数类型 D)函数名称 【参考答案】 D 21.下列程序的输出结果为 #include int func(int n) { if (n<1)return 1; else return n+func(n-1); return 0; } void main() { cout< A)0 B)10 C)15 D)16 【参考答案】 D 22.在C++语⾔中,数据封装要解决的问题是 A)数据的规范化 B)便于数据转换 C)避免数据丢失 D)防⽌不同模块之间数据的⾮法访问 【参考答案】 D 23.以下程序中,错误的⾏为 (1) #include (2) ClassA (3) { (4) public: (5) int n=2; (6) A(int val){cout< (7) ~A( ){} (8) }; (9) void main( ) (10) { (11) Aa(o); (12) } A)(5) B)(6) C)(7) D)(11) 【参考答案】 A 24.对类的构造函数和析构函数描述正确的是 A)构造函数可以重载,析构函数不能重载 B)构造函数不能重载,析构函数可以重载 C)构造函数可以重载,析构函数也可以重载 D)构造函数不能重载,析构函数也不能重载 【参考答案】 A 25.下⾯程序的运⾏结果为 #include class A { int num; public: A(int i){num=i;} A(A &a){num=a.num++;} void print(){cout< void main() { A a (1),b(a); a.print(); b.print(); } A)11 B)12 C)21 D)22 【参考答案】 C 26.下⾯对静态数据成员的描述中,正确的是 A)静态数据成员是类的所有对象共享的数据 B)类的每个对象都有⾃⼰的静态数据成员 C)类的不同对象有不同的静态数据成员值 D)静态数据成员不能通过类的对象调⽤ 【参考答案】 A 27.如果类A被说明成类B的友元,则 A)类A的成员即类B的成员 B)类B的成员即类A的成员 C)类A的成员函数不得访问类B的成员 D)类B不⼀定是类A的友元 【参考答案】 D 28.可以⽤p.a的形式访问派⽣类对象p的基类成员a,其中a是 A)私有继承的公有成员 B)公有继承的私有成员 C)公有继承的保护成员 D)公有继承的公有成员 【参考答案】 D 29.建⽴派⽣类对象时,3种构造函数分别是a(基类的构造函数)、b(成员对象的构造函数)、c(派⽣类的构造函数)这3种构造函数的调⽤顺序为 A)abc B)acb C)cab D)cba 【参考答案】 A 30.下⾯关于虚函数的描述,错误的是 A)在成员函数声明的前⾯加上virtual修饰,就可把该函数声明为虚函数 B)基类中说明了虚函数后,派⽣类中对应的函数也必须说明为虚函数 C)虚函数可以是另⼀个类的友元函数,但不能是静态成员函数 D)基类中说明的纯虚函数在其任何派⽣类中都必须实现 【参考答案】 B 31.下⾯关于模板的描述,错误的是 A)函数模板和类模板的参数可以是任意的数据类型 B)类模板不能直接使⽤,必须先实例化为相应的模板类,然后定义了模板类的对象后才能使⽤ C)函数模板不能直接使⽤,需要实例化为模板函数后才能使⽤ D)类模板的成员函数都是模板函数 【参考答案】 A 32.语句ofstream f("SALARY.DAT",ios::app|ios::binary);的功能是建⽴流对象f,试图打开⽂件SALARY.DAT并与之连接,并且 A)若⽂件存在,将⽂件写指针定位于⽂件尾;若⽂件不存在,建⽴⼀个新⽂件 B)若⽂件存在,将其置为空⽂件;若⽂件不存在,打开失败 C)若⽂件存在,将⽂件写指针定位于⽂件⾸;若⽂件不存在,建⽴⼀个新⽂件 D)若⽂件存在,打开失败;若⽂件不存在,建⽴⼀个新⽂件 【参考答案】 A 33.下⾯程序的运⾏结果是 #include void main() { int num=1; int &ref=num; ref=ref+2; cout < num=num+3; B)16 C)36 D)33 【参考答案】 C 34.下⾯程序的运⾏结果是 #include void fun(int *a,int *b) { int x=*a; *a=*b; *b=x; cout< } void main() { int x=1, y=2; fun(&x,&y); cout< A)1212 B)1221 C)2112 D)2121 【参考答案】 D 35.下列程序的运⾏结果为 #include int i=0; class A{ public: A(){i++;} }; void main() { A a,b[3],*c; c=b; cout< A)2 B)3 【参考答案】 C ⼆、填空题 (1)数据结构分为逻辑结构与存储结构,线性链表属于【1】。

VC试卷(含参考答案)

VC试卷(含参考答案)

使用前注意保密江苏科技大学非计算机专业学生Visual C++ 程序设计语言期末考试试卷代号:VC09说明:1、本试卷为笔试题,含选择、填空、及编程三部分。

2、本试卷满分为100分,考试时间为120分钟。

3、所有答案必须写在答题纸上,否则不计成绩。

3、填写答案时,注意题号;特别是填空题,做到答案、填空号与试题对应。

4、答题纸上必须写明学号(含班级号)、姓名。

1、设a,b为整型变量,且均不为0,以下关系表达式中恒成立的是。

:A、 a*b/a*b==1B、 a/b*b/a==1C、 a/b*b==aD、 a/b*b+a%b==a2、在C++中,判断char型变量ch是否为大写字母的正确表达式是。

:A、’A’<=ch<=’Z’B、 (ch>=’A’)&(ch<=’Z’)C、 (ch>=’A’)&&(ch<=’Z’)D、 (‘A’<=ch)AND(‘z’>=ch)3、设有说明语句:char str[]="abcde"; int a[5];下列选项中,存在语法错误的是:A.cout<<str; B.cin>>str; C.cin>>a; D.cin>>a[0];4、下列二维数组的定义中,不正确的是:A、 int i[][4]={{1,2,3},4,5};B、 int i[4][]={1,2,3,4,5,6};C、 int i[][4]={1,2};D、int i[4][4]={{1},{2},{3},{4}};5、设有宏定义如下,则变量x的值为:# define A 4# define B A+6# define C(x) x*B/2int x=C(2+8);A、 50B、43C、42D、376、设有说明语句:void fun(int *t1,int &t2); int a=5,b=10;以下对函数fun的调用语句中,正确的是:A. f(a,b); B.f(&x,&y); C.f(a,&b); D.f(&a,b);7、设有说明: int a=5,b=5,c;执行语句:c= a>b && (c=b)&& (b*=a++); 则a、b、c的值分别为:A.6,25, 0 B.5,5,0 C.5, 5,5 D.6,25,58、关于类的访问特性的说明,下列说法正确的是()A 在同一个类中,说明访问特性的关键字可以多次使用B 成员数据必须说明为私有的C 必须在每一个成员前单独标明访问特性D 必须首先说明私有特性的成员9、用友元函数进行单目运算符重载时,该友元函数的参数表中参数的个数为:A.0 B.1 C.2 D.1或 210、以下有关this指针的叙述中,不正确的是:A.类的非静态成员函数中存在一个this指针B.this指针缺省的初值为0C.类的非静态成员函数中可直接使用this指针D.this指针指向当前对象1、设有int a,b;执行语句:b=(a=2+3,a*4),a+5;后,a+b的值为 (1) 。

2013年计算机二级C++模拟试题及答案(5)

2013年计算机二级C++模拟试题及答案(5)

⼀、选择题 1.根据数据结构中各数据元素之间前后件关系的复杂程度,⼀般将数据结构分成( ) A.动态结构和静态结构 B.紧凑结构和⾮紧凑结构 C.线性结构和⾮线性结构 D.内部结构和外部结构 【参考答案】 C 2.在下列⼏种排序⽅法中,要求内存量的是( ) A.插⼊排序 B.选择排序 C.快速排序 D.归并排序 【参考答案】 D 3.下列不属于软件调试技术的是( ) A.强⾏排错法 B.集成测试法 C.回溯法 D.原因排除法 【参考答案】 B 4.软件复杂性度量的参数包括( ) A.效率 B.规模 C.完整性 D.容错性 【参考答案】 B 5.数据库系统的核⼼是( ) A.数据库 B.数据库管理系统 C.数据库模型 D.软件⼯具 【参考答案】 B 6.最简单的交换排序⽅法是( ) A.快速排序 B.选择排序 C.堆排序 D.冒泡排序 【参考答案】 D 7.线性表的顺序存储结构和线性表的链式存储结构分别是( ) A.顺序存取的存储结构、顺序存取的存储结构 B.随机存取的存储结构、顺序存取的存储结构 C.随机存取的存储结构、随机存取的存储结构 D.任意存取的存储结构、任意存取的存储结构 【参考答案】 B 8.在结构化设计⽅法中,⽣成的结构图(SC)中,带有箭头的连线表⽰( ) A.模块之间的调⽤关系 B.程序的组成成分 C.控制程序的执⾏顺序 D.数据的流向 【参考答案】 A 9.⼀个关系中属性个数为1时,称此关系为( ) A.对应关系 B.单⼀关系 C.⼀元关系 D.⼆元关系 【参考答案】 C 10.相对于数据库系统,⽂件系统的主要缺陷有数据关联差、数据不⼀致性和( ) A.可重⽤性差 B.安全性差 C.⾮持久性 D.冗余性 【参考答案】 D 11.下列选中不全是C++关键字的是( ) A.const,break,default B.long,void,using C.virtual,extern,include D.try,throw,this 【参考答案】 C 12.在32位的计算机中,⼀个char型数据所占的内存长度的字节是( ) A.4 B.1 C.2 D.8 【参考答案】 B 13.有如下程序: #include″iostream.h″ void main() { int x=1,a=0,b=0; switch(x) { case 0:b++; case 1:a++; case 2:a++;b++; } cout< 该程序的输出结果是( ) A.a=2,b=1 B.a=1,b=1 C.a=1,b=0 D.a=2,b=2 【参考答案】 A 14.若有说明int a[3][4];,则a数组元素的⾮法引⽤是( ) A.a[0][2*1] B.a[1][3] C.a[4-2][0] D.a[0][4] 【参考答案】 D 15.若已定义的函数有返回值,则以下关于该函数调⽤的叙述中错误的是( ) A.函数调⽤可以作为独⽴的语句存在 B.函数调⽤可以⽆返回值 C.函数调⽤可以出现在表达式中 D.函数调⽤可以作为⼀个函数的形参 【参考答案】 D 16.以下类定义中可能会引起错误的语句是( ) class A { public: ~A(){ } //1 int i; //2 private: int j; //3 A(int i){i++;} //4 }; A.1 B.2 C.3 D.4 【参考答案】 D 17.下列描述中错误的是( ) A.派⽣类可以作为基类派⽣其他的⼦类 B.派⽣类继承基类的所有数据成员 C.派⽣类可以有多个基类 D.派⽣类不能继承⼀些函数成员 【参考答案】 B 18.下列运算符中哪些是不能够被重载的?( ) A..,.*,->*,::,?: B.++,--,new,delete,== C.sizeof,new,delete,++,-- D.sizeof,new,delete,+,- 【参考答案】 A 19.下列关于函数模板实参不能省略的情况说明不正确的是( ) A.从模板函数实参表获得的信息有⽭盾 B.需要获得特定类型的返回值,⽽不管参数的类型如何 C.虚拟类型参数没有出现在模板函数的形参表中 D.函数模板不含有常规形参 【参考答案】 D 20.表达式10>5&&6%3的值是( ) A.-1 B.⾮零值 C.0 D.1 【参考答案】 C 21.以下函数调⽤语句中含有参数个数是( ) excc((v1,v2),(v2,v3,v4),v6); A.3 B.4 C.5 【参考答案】 A 22.下列程序段的输出结果是( ) #include void fun(fun *x,int *y) { cout< *x=3; *y=4; } void main() { int x=1,y=2; fun(&y,&x); cout< A.2143 B.1212 C.1.4 D.2112 【参考答案】 A 23.下列程序的输出结果是( ) #include void main() { char *str=″12123434″; int x1=0,x2=0,x3=0,x4=0,i; for(i=0;str[i]!=′\0′;i++) switch(str[i]) { case′1′:x4++; case′2′:x3++; case′3′:x2++; case′4′:x1++;〗 } cout< A.8,6,4,1 B.8,6,3,2 C.8,8,4,1 D.8,6,4,2 【参考答案】 D 24.每个C++程序中都必须有且仅有⼀个( ) B.预处理命令 C.主函数 D.语句 【参考答案】 C 25.设有int x=11;,则表达式(x++*2/3)的值是( ) A.7 B.8 C.11 D.12 【参考答案】 A 26.对表达式for(表达式1;;表达式3)可理解为( ) A.for(表达式1;0;表达式3) B.for(表达式1;1;表达式3) C.for(表达式1;表达式3) D.for(;;表达式3) 【参考答案】 B 27.有如下说明 int a[10]={1,2,3,4,5,6,7,8,9,10},*p=a; 则数值为9的表达式是( ) A.*p+9 B.*(p+8) C.*p+=9 D.p+8 【参考答案】 B 28.以下对C++语⾔函数的有关描述中,正确的是( ) A.在C++语⾔中调⽤函数,只能把实参的值传给形参,形参的值不能传送给实参 B.C++语⾔函数既可以嵌套定义⼜可以递归调⽤ C.函数必须⽆返回值,否则不能使⽤函数 D.函数必须有返回值,返回值类型不定 【参考答案】 A 29.拷贝构造函数的参数⼀般是( ) A.某对象名 B.某对象成员名 C.某对象的引⽤名 D.指向对象的指针名 【参考答案】 C 30.下⾯这个程序的结果是( ) #include class A { private: int a; public: void seta();int geta();}; void A::seta() { a=1;} int A::gate() { return a;} class B { private: int a; public: void seta();int geta();}; void B::seta() {a=2;} int B::geta() {return a;} class C:public A,public B { private: int b; public: void display();}; void C::display() { int b=geta(); cout< void main() C c; C.seta(); C.display();} A.1 B.2 C.随机输出1或2 D.程序有错 【参考答案】 D 31.对于模板定义关键字class和typename说法不正确的是( ) A.程序中的class并不能都替换为typename B.class和typename都可互相替换 C.程序中的typename都能替换为class D.程序中的部分class可以替换为typename 【参考答案】 B 32.以下程序的输出结果是( ) #include long fun(int n) { long s; if(n==1||n==2)s=2; else s=n-fun(n-1); return s; } void main() { cout< A.1 B.2 C.3 D.4 【参考答案】 A 33.有如下程序 #include void main() { char ch[2][5]={″6937″,″8254″},*p[2]; int i,j,s=0; for(i=0;i<2;i++)p[i]=ch[i]; for(i=0;i<2;i++) for(j=0;p[i][j]>′\0′;j+=2) s=10*s+p[i][j]-′0′; cout< 该程序的输出结果是( ) A.69825 B.63825 C.6385 D.693825 【参考答案】 C 34.以下程序的输出结果是( ) #include void main() { char x=040; cout< A.100 B.80 C.64 D.32 【参考答案】 C 35.对以下说明语句的正确理解是( ) int a[10]={6,7,8,9,10}; A.将5个初值依次赋给a[1]⾄a[5] B.将5个初值依次赋给a[0]⾄a[4] C.将5个初值依次赋给a[6]⾄a[10] D.因为数组长度与初值的个数不相同,所以此语句不正确 【参考答案】 B ⼆、填空题 1.算法的⼯作量⼤⼩和实现算法所需的存储单元多少分别称为算法的【1】。

VC作业参考答案全_1115

VC作业参考答案全_1115

参考答案作业1 VC++基本程序结构一、填空题1.(1)函数(2)main()2.(1)函数体(2)分号3.(1)两或二或2 (2)大小写4.(1)cin (2)cout5.(1)//6.(1)/* (2)*/7.(1)#include8.(1)#9.(1).h (2).cpp10.(1)用户(或编程者)二、单选题1.A2.D 3.A4.A5.C 6.B 7.B 8.C 9.D作业2 数据类型、常量、变量、运算符一、单选题1.D 2.B 3.B 4.D 5.D 6.D 7.C 8.B 9.B 10.C 11.C 12.B二、阅读程序题1.10 12 19 412.I say:”C++” He says:”C++ is very interstiing!”三、程序设计题1.#include <iostream.h>void main(){char c1='C', c2='h', c3='i', c4='n', c5='a';c1+=4;c2+=4;c3+=4;c4+=4;c5+=4;cout<<"password is:"<<c1<<c2<<c3<<c4<<c5<<endl;}作业3 表达式一、单选题1.B 2.D 3.A4.C 5.C 6.A7.B 8.C二、填空题1. (1)352.(1)253.(1)6 (2)304.(1)4 (2)115.(1)(x+y)/(2*x*y)6.(1)1/(a*x*x+b*y*y)7.(1)208.(1)1 (2)39.(1)3 (2)3.210.(1)6 (2)6011.(1)x12.(1)true(或1)13.(1)false(或0)14.(1)x15.(1)!x16.(1)false(或0)17.(1)true(或1)三、写出下面各逻辑表达式的值1.(1)-72.5 (2)11.5 (3)23 (4)9 (5)6 (6)6 (7)4 2.(1)24 (2)9 (3)60 (4)0 (5)0 (6)03.(1)0 (2)1 (3)1 (4)0 (5)1作业4 简单的输入输出一、阅读程序题1.ThisisaC++program.2.a+b=333.a=3 b=2 x=1.8 y=7.0 ch1=a ch2=’ ’ ch3=b4.a=19 b=19 c=35 d=235.19 13 43二、程序改错1.1)#define pi 3.14162)去掉此句r=2.8;3)cout<<c2<<s2;三、程序设计1.# include <iostream.h>main(){ cout<<" ***************"<<'\n';cout<<" Hello!"<<'\n';cout<<" ***************"<<'\n';}2.# include <iostream.h>main(){ int s1,s2,s3,sum;cout<<"请输入三个学生的成绩:";cin>>s1>>s2>>s3;sum=s1+s2+s3;cout<<"sum="<<sum<<'\n';}3.# include <iostream.h>void main(){cout<<"please input a small character :";char a;cin>>a;char b=a-32;cout<<b<<endl;}4.#include <iostream.h>void main (){float c,f;int a;cout<<"请输入一个华氏温度:";cin>>f;c=(5.0/9.0)*(f-32); //注意5和9要用实型表示,否则5/9值为0 a=c*100+0.5; c= a/100.0; //保留保留两位小数,对第三小数位四舍五入cout<<"摄氏温度为:"<<c <<endl;}作业5 选择结构语句一、填空题1.(1)顺序结构(2)循环结构2.(1)字符型、枚举型3.(1)if4.(1)switch5.(1)不停止(或继续)二、阅读程序题1.132.121a,b,c=7,12,303.11 14 switch end.4.10 6 4三、程序设计参考程序:1.//方法一:#include <iostream.h>void main ( ){int a,b,c;cout<<"please enter three integer numbers:";cin>>a>>b>>c;if(a<b)if(b<c)cout<<"max="<<c;elsecout<<"max="<<b;else if (a<c)cout<<"max="<<c;elsecout<<"max="<<a;cout<<endl;}//方法二:#include <iostream.h>void main ( ){int a,b,c,temp,max ;cout<<"please enter three integer numbers:";cin>>a>>b>>c;temp=(a>b)?a:b; //将a和b中的大者存入temp中max=(temp>c)?temp:c; // 将a和b中的大者与c比较,最大者存入max cout<<"max="<<max<<endl;}2.#include <iostream.h>void main (){float score;char grade;cout<<"please enter score of student:";cin>>score;while (score>100||score<0){cout<<"data error,enter data again.";cin>>score;}switch(int(score/10)){case 10:case 9: grade='A';break;case 8: grade='B';break;case 7: grade='C';break;case 6: grade='D';break;default:grade='E';}cout<<"score is "<<score<<", grade is "<<grade<<endl;}3.#include <iostream.h>#include <stdio.h>void main (){char c;int letters=0,space=0,digit=0,other=0;cout<<"enter one line::"<<endl;while((c=getchar())!='\n'){if (c>='a' && c<='z'||c>='A' && c<='Z')letters++;else if (c==' ')space++;else if (c>='0' && c<='9')digit++;elseother++;}cout<<"letter:"<<letters<<", space:"<<space<<", digit:"<<digit<<", other:"<<other<<endl;}4.#include <iostream.h>void main ( ){int x,y;cout<<"enter x:";cin>>x;if (x<1){y=x;cout<<"x="<<x<<", y=x="<<y;}else if (x<10) // 1≤x<10{y=2*x-1;cout<<"x="<<x<<", y=2*x-1="<<y;}else // x≥10{y=3*x-11;cout<<"x="<<x<<", y=3*x-11="<<y;}cout<<endl;}5.#include <iostream.h>void main (){int t,a,b,c,d;cout<<"enter four numbers:";cin>>a>>b>>c>>d;cout<<"a="<<a<<", b="<<b<<", c="<<c<<",d="<<d<<endl;if (a>b){t=a;a=b;b=t;}if (a>c){t=a; a=c; c=t;}if (a>d){t=a; a=d; d=t;}if (b>c){t=b; b=c; c=t;}if (b>d){t=b; b=d; d=t;}if (c>d){t=c; c=d; d=t;}cout<<"the sorted sequence:"<<endl;cout<<a<<", "<<b<<", "<<c<<", "<<d<<endl;}作业6 循环结构语句一、单选题1.C 2.C 3.A4.C 5.B 6.D二、写出程序的结果1.3332.s=60三、程序填空题1.(1)f1+f2 (2)i%5==0 (3)f2.(1)b<=0 (2)a=b (3)b=r四、程序设计参考程序:1. #include<iostream.h>void main(){ int i=0; double s=0;while(s<5) s+=double(1)/++i;cout<<"n="<<i<<endl;}//若采用for循环编写程序,则如下所示:#include<iostream.h>void main(){int i; double s=0;for(i=1; s<5; i++) s+=1.0/i;cout<<"n="<<i-1<<endl;//注意:此i-1的值为所求的n值}2. #include <iostream.h>void main (){int i,j,k,n;cout<<"narcissus numbers are:"<<endl;for (n=100;n<1000;n++){i=n/100;j=n/10-i*10;k=n%10;if (n == i*i*i + j*j*j + k*k*k)cout<<n<<" ";}cout<<endl;}3. #include <iostream.h>void main(){int day,x1,x2;day=9;x2=1;while(day>0){x1=(x2+1)*2; // 第1天的桃子数是第2天桃子数加1后的2倍 x2=x1;day--;}cout<<"total="<<x1<<endl; //1534}4.#include <iostream.h>void main(){int i,k;for (i=0;i<=3;i++) // 输出上面4行*号{for (k=0;k<=2*i;k++)cout<<"*"; // 输出*号cout<<endl; //输出完一行*号后换行}for (i=0;i<=2;i++) // 输出下面3行*号{ for (k=0;k<=4-2*i;k++)cout<<"*"; // 输出*号cout<<endl; // 输出完一行*号后换行}}5.#include <iostream.h>void main(){ int i,t,n=20;double a=2,b=1,s=0;for (i=1;i<=n;i++){ s=s+a/b;t=a;a=a+b; // 将前一项分子与分母之和作为下一项的分子 b=t; // 将前一项的分子作为下一项的分母}cout<<"sum="<<s<<endl;}作业7 控制执行顺序的语句一、填空题1.(1)break2.(1)continue3.(1)return4.(1)主(或main)5.(1)n/2+1二、写出程序的运行结果1.32.1 5 7 11 13 373.a=2b=8三、程序填空题1.(1)j<=temp (2)break (3)j>tempj<temp+1 j>=temp+1四、程序设计参考程序:1.//方法一#include <iostream.h>void main(){int m,s,i;for (m=2;m<1000;m++){s=0;for (i=1;i<m;i++)if ((m%i)==0) s=s+i;if(s==m){cout<<m<<" is a完数"<<endl;cout<<"its factors are:";for (i=1;i<m;i++)if (m%i==0) cout<<i<<" ";cout<<endl;}}}//方法二#include <iostream.h>void main(){const int m=1000; // 定义寻找范围int k1,k2,k3,k4,k5,k6,k7,k8,k9,k10;int i,a,n,s;for (a=2;a<=m;a++) // a是2~1000之间的整数,检查它是否为完数{n=0; // n用来累计a的因子的个数s=a; // s用来存放尚未求出的因子之和,开始时等于afor (i=1;i<a;i++) // 检查i是否为a的因子if (a%i==0) // 如果i是a的因子{n++; // n加1,表示新找到一个因子s=s-i; // s减去已找到的因子,s的新值是尚未求出的因子之和switch(n) // 将找到的因子赋给k1,...,k10{case 1:k1=i; break; // 找出的笫1个因子赋给k1case 2:k2=i; break; // 找出的笫2个因子赋给k2case 3:k3=i; break; // 找出的笫3个因子赋给k3case 4:k4=i; break; // 找出的笫4个因子赋给k4case 5:k5=i; break; // 找出的笫5个因子赋给k5case 6:k6=i; break; // 找出的笫6个因子赋给k6case 7:k7=i; break; // 找出的笫7个因子赋给k7case 8:k8=i; break; // 找出的笫8个因子赋给k8case 9:k9=i; break; // 找出的笫9个因子赋给k9case 10:k10=i; break; // 找出的笫10个因子赋给k10}}if (s==0) // s=0表示全部因子都已找到了{cout<<a<<" is a 完数"<<endl;cout<<"its factors are:";if (n>1) cout<<k1<<","<<k2; // n>1表示a至少有2个因子if (n>2) cout<<","<<k3; // n>2表示至少有3个因子,故应再输出一个因子if (n>3) cout<<","<<k4; // n>3表示至少有4个因子,故应再输出一个因子if (n>4) cout<<","<<k5; // 以下类似if (n>5) cout<<","<<k6;if (n>6) cout<<","<<k7;if (n>7) cout<<","<<k8;if (n>8) cout<<","<<k9;if (n>9) cout<<","<<k10;cout<<endl<<endl;}}}//方法三#include <iostream.h>void main(){int k[11];int i,a,n,s;for (a=2;a<=1000;a++){n=0;s=a;for (i=1;i<a;i++)if ((a%i)==0){n++;s=s-i;k[n]=i; // 将找到的因子赋给k[1]┅k[10]}if (s==0){cout<<a<<" is a 完数"<<endl;cout<<"its factors are:";for (i=1;i<n;i++)cout<<k[i]<<" ";cout<<k[n]<<endl;}}}2.#include <iostream.h>void main(void ){cout << "The primes in [3,20] are:"<<endl;for(int i=3;i<=20;i++) //从3到20的循环体{ int p=1; //1=素数;0=非素数for(int j=2; j<=i/2; j++) //从1到i/2的循环体{if(i%j==0) // i被j整除{ p=0; //是非素数break; } //中止对j的循环}if(p==0)continue; //若是非素数转向到i++cout << i << ", "; //输出素数i }}3.#include <iostream.h>void main(void){ for( int n=100; n<=200; n++){ if (n%3 == 0)continue; //break;cout<<n<<"";}}作业8 函数的定义和调用一、单选题1.B2.B3.B4.A5.A6.A7.A二、填空题1.(1)float fun(int,int,int=5,int=5);2.(1)值传递(2)地址传递(3)引用传递3.(1)94.(1)245.(1)150*50=0(2)值传递三、程序设计题参考程序:1.#include <iostream.h>#include <stdlib.h>int jc(int n){int j=1,i;if(n<0){cout<<"n应为正数!"<<'\n';exit(1);}if(n==0)return 1;for(i=2;i<=n;i++)j*=i;return j;}int zh(int m,int r){int c;if(m<=r){cout<<"m必须大于r!"<<'\n';exit(1);}c=jc(m)/(jc(r)*jc(m-r));return c;}void main(void){cout<<"C(4,2)="<<zh(4,2)<<'\n';cout<<"C(6,4)="<<zh(6,4)<<'\n';cout<<"C(8,7)="<<zh(8,7)<<'\n'; }2.#include <iostream.h>int add(int x,int y){ return x+y; }int sub(int x,int y){ return x-y; }int mul(int x,int y){ return x*y; }int div(int x,int y){ return x/y; }void main(){ int a,b,c;char op1,op2;cout<<"请输入算式(如3+4=):";cin>>a>>op1>>b>>op2;switch(op1){case '+':c=add(a,b); break;case '-': c=sub(a,b); break;case '*': c=mul(a,b); break;case '/':c=div(a,b);}cout<<"结果是:"<<c<<endl;}作业9 作用域与存储类一、单选题1.A2.C二、填空题1.(1)15,15,5 (2)5,15,152.(1)3 43.(1)11 (2)184.(1)95.12 -25 25作业10 函数的重载、编译预处理一、单选题1.C2.A3.C4.B5.B二、填空题1.(1)宏定义(2)文件包含2.(1)#define area(a) ((a)*(a))3.(1)F=34.(1)505.(1)3行(2)3行函数的调用产生了二义性,或1行和2行定义的函数不能构成重载函数6.(1)3行(2)3行函数的调用产生了二义性,或1行和2行定义的函数不能构成重载函数三、改错题1.#define MAX 10for(count=MAX;count>=0;--count)2.if(value<0){ DIG; }四、程序设计题1.参考程序:#include <iostream.h>#define MIN(a,b) ((a)<(b)?(a):(b))void main(){ int x,y;cout<<"请输入两个数:";cin>>x>>y;cout<<"最小数为:"<<MIN(x,y)<<endl;}作业11 一维数组的定义及应用一、单选题1.D2.D3.C4.D二、填空题1.(1)1101三、程序填空题1.(1)p=0 (2)p=i2.(1) int min=f[i] (2)min=f[j](3)f[i]> min3.(1)j+=2 (2)prime[j]&&prime[j]%prime[i]==0 或prime[j]%prime[i]==0(3) j=0(4) j%8==0四、程序设计题1.参考程序:#include <iostream.h>void main(){ int a[100],b[100],c[100];int max2,max1,j=0,k=0,t;float avg,s=0;cout<<"请输入一组整数(0结束):";int i=0;do{cin>>a[i];s+=a[i];i++;}while(a[i-1]);t=i-1;cout<<"共输入"<<t<<"个整数!"<<endl;for(i=0;i<=t;i++)if(a[i]>0)j++;else if(a[i]<0) k++;avg=s/t;cout<<"这组数的平均值为"<<avg<<endl;cout<<"其中输入的正整数个数为:"<<j<<endl;cout<<"其中输入的负整数个数为:"<<k<<endl;}作业12 二维数组的定义及应用一、单选题1.D2.B3.D4.B5.D6.D二、填空题1.(1)n* i +j+12.(1)357三、程序填空题1.(1)j=i+1 (2)a[i][j]!=a[j][i]四、改错题1.(1)void find(int a[][4],int n) (2)int max=a[i][0];(3)if(a[i][j]>max) (4)break;五、程序设计题1.参考程序:#include <iostream.h>void main(){ int i,j,a[3]={8,6,4},b[4]={9,7,5,3},c[3][4];for(i=0;i<3;i++)for(j=0;j<4;j++)c[i][j]=a[i]*b[j];for(i=0;i<3;i++){ for(j=0;j<4;j++)cout<<c[i][j]<<'\t';cout<<endl;}}作业13 字符数组的定义及应用一、单选题1.C2.C3.C4.D5.D6.A7.D二、填空题1.(1)d2.(1)45493.(1)a (2)d三、程序填空题1.(1)!(s[i]>='0'&&s[i]<='9') (2)s[j]='\0'四、程序设计题1.参考程序:#include<iostream.h>int fun(char str1[],char str2[]){int i,j,k;for(i=0;str1[i];i++)for(j=i,k=0;str2[k]==str1[j];k++,j++)if(str2[k+1]=='\0')return i+1;return 0;}void main(){int m=0;char s1[100],s2[100];cin.getline(s1,100);cin.getline(s2,100);if(fun(s1,s2))cout<<s2<<"是"<<s1<<"的子串,位置在:"<<fun(s1,s2)<<endl;else cout<<s2<<"不是"<<s1<<"的子串。

2013《Visual BASIC程序设计》期末考试编程题复习及答案

2013《Visual BASIC程序设计》期末考试编程题复习及答案

第2章1.新建工程,在窗体上创建两个命令按钮Command1、Command2,一个标签Label1,界面如图2-5所示,程序运行要求如下:1)单击“改变颜色”按钮,标签上的文字内容改为“颜色已经改变”,文字颜色改为红色。

“改变颜色”按钮代码:Label1.ForeColor = vbRedLabel1.Caption = "颜色已经改变"2)单击“改变字体”按钮,标签上的字体改为“黑体”。

“改变字体”按钮代码:Label1.FontName = "黑体"图2-5程序运行界面最后将工程文件、窗体文件分别以lx2-2.vbp、lx2-2.frm为文件名保存在D:\EX文件夹下。

2.设计一个留言薄。

新建一个工程,在窗体上创建2个标签,2个文本框,1个命令按钮,属性设置如图2-6所示,。

要求单击“提交”按钮后,上面的文本框内容复制到下面的文本框中,且下面文本框中的内容不能修改。

单击“清除”按钮则清除两个文本框中的内容。

“提交”按钮代码:Text2.Text = Text1.Text“清除”按钮代码:Text1.Text = ""Text2.Text = ""图2-6 程序界面最后将工程文件、窗体文件分别以lx2-4.vbp、lx2-4.frm为文件名保存在D:\EX文件夹下。

3.设计一个程序,程序界面如图2-7所示。

当单击“显示”按钮时,在文本框中显示“欢迎使用VB!”;当单击“清除”按钮时,清除文本框内的文本;当单击“退出”按钮时,结束程序运行。

“显示”按钮代码:Text1.Text = "欢迎使用VB!"“清除”按钮代码:Text1.Text = ""“退出”按钮代码:End图2-7 程序运行界面最后将工程文件、窗体文件分别以lx2-5.vbp、lx2-5.frm为文件名保存在D:\EX文件夹下。

2013全国大学生数学建模竞赛C题参考答案

2013全国大学生数学建模竞赛C题参考答案

2013全国大学生数学建模竞赛C题参考答案第一篇:2013全国大学生数学建模竞赛C题参考答案2013高教社杯全国大学生数学建模竞赛C题评阅要点[说明]本要点仅供参考,各赛区评阅组应根据对题目的理解及学生的解答,自主地进行评阅。

问题1(1)补充1986年和1996年缺失的数据(第13层第5点),可用外推法或几何方法补充数据。

(2)因各层基本处于同一平面内,可先拟合出各层所在平面,将各测量点投影到拟合平面内,然后再用均匀物体的重心公式计算中心坐标。

注:(1)对1986年和1996年第13层,不补充数据,直接用7个点的数据计算中心坐标是错误的。

(2)用各层测量点坐标的平均值作为中心点坐标,不是一种好方法。

问题2(1)倾斜程度:对中心点作线性拟合,中轴线与水平面法向的夹角可作为倾斜程度的度量。

(2)弯曲程度:对中心点作三次样条拟合,三次样条曲线各点曲率的平均值可作为弯曲程度的度量。

也可用离散方法:连接各层的对应点,折线各顶点角度的平均值可作为弯曲程度的度量。

(3)扭曲程度:相邻两个平面的旋转角度可作为扭曲程度的度量。

问题3变形趋势:对问题2中的各种变形,关于时间作拟合,推测出未来几年的变化情况。

第二篇:2006全国大学生数学建模竞赛题目(A题)2006全国大学生数学建模竞赛题目-------A题:出版社的资源配置出版社的资源主要包括人力资源、生产资源、资金和管理资源等,它们都捆绑在书号上,经过各个部门的运作,形成成本(策划成本、编辑成本、生产成本、库存成本、销售成本、财务与管理成本等)和利润。

某个以教材类出版物为主的出版社,总社领导每年需要针对分社提交的生产计划申请书、人力资源情况以及市场信息分析,将总量一定的书号数合理地分配给各个分社,使出版的教材产生最好的经济效益。

事实上,由于各个分社提交的需求书号总量远大于总社的书号总量,因此总社一般以增加强势产品支持力度的原则优化资源配置。

资源配置完成后,各个分社(分社以学科划分)根据分配到的书号数量,再重新对学科所属每个课程作出出版计划,付诸实施。

2013年计算机二级C++模拟试题及答案(3)

2013年计算机二级C++模拟试题及答案(3)

⼀、选择题 1.数据结构作为计算机的⼀门学科,主要研究数据逻辑结构、对各种数据结构进⾏运算,及( ) A.数据的存储结构 B.计算⽅法 C.数据映象 D.逻辑存储 【参考答案】 A 2.在计算机中,算法是指( ) A.加⼯⽅法 B.解题⽅案的准确⽽完整的描述 C.排序⽅法 D.查询⽅法 【参考答案】 B 3.开发软件所需⾼成本和产品的低质量之间有着尖锐的⽭盾,这种现象称做( ) A.软件投机 B.软件危机 C.软件⼯程 D.软件产⽣ 【参考答案】 B 4.开发⼤型软件时,产⽣困难的根本原因是( ) A.⼤系统的复杂性 B.⼈员知识不⾜ C.客观世界千变万化 D.时间紧、任务重 【参考答案】 A 5.数据库、数据库系统和数据库管理系统之间的关系是( ) A.数据库包括数据库系统和数据库管理系统 B.数据库系统包括数据库和数据库管理系统 C.数据库管理系统包括数据库和数据库系统 D.3者没有明显的包含关系 【参考答案】 B 6.下列叙述中正确的是( ) A.线性表是线性结构 B.栈与队列是⾮线性结构 C.线性链表是⾮线性结构 D.⼆叉树是线性结构 【参考答案】 A 7.已知数据表A中每个元素距其最终位置不远,为节省时间,应采⽤的算法是( ) A.堆排序 B.直接插⼊排序 C.快速排序 D.直接选择排序 【参考答案】 B 8.下列不属于结构化分析的常⽤⼯具的是( ) A.数据流图 B.数据字典 C.判定树 D.PAD图 【参考答案】 A 9.下列⼯具中为需求分析常⽤⼯具的是( ) A.PAD B.PFD C.N-S D.DFD 【参考答案】 D 10.数据库的故障恢复⼀般是由( ) A.数据流图完成的 B.数据字典完成的 C.DBA完成的 D.PAD图完成的 【参考答案】 C 11.关于C++与C语⾔关系描述中错误的是( ) A.C++语⾔是C语⾔的超集 B.C++语⾔对C语⾔进⾏了扩充 C.C++语⾔包含C语⾔的全部语法特征 D.C++语⾔与C语⾔都是⾯向对象的程序设计语⾔ 【参考答案】 D 12.在C++语⾔中,不合法的实型数据的是( ) A.0.123 B.123e3 C.2.1e3.5 D.123.0 【参考答案】 C 13.下⾯有关于for循环的正确描述是( ) A.for循环只能⽤于循环次数已经确定的情况 B.for循环是先执⾏循环体语句,后判断表达式 C.在for循环中,不能⽤break语句跳出循环体 D.for循环的循环体语句中,可以包含多条语句,但必须⽤花括号括起来 【参考答案】 D 14.假定int类型变量占⽤两个字节,其有定义int x[10]={0,2,4};,则数组x在内存中所占字节数是( ) A.3 B.6 C.10 来源: D.20 【参考答案】 D 15.以下叙述正确的是( ) A.函数可以嵌套定义但不能嵌套调⽤ B.函数既可以嵌套调⽤也可以嵌套定义 C.函数既不可以嵌套定义也不可以嵌套调⽤ D.函数可以嵌套调⽤但不可以嵌套定义 【参考答案】 D 16.下⾯的语句中错误的是( ) A.int a=5;int x[a]; B.const int a=5;int x[a]; C.int n=5;int *p=new int[a]; D.const int n=5;int *p=new int[a]; 【参考答案】 A 17.关于⼆义性的描述错误的是( ) A.⼀个⼦类的两个⽗类中都有某个同名成员,在⼦类中对该成员访问可能出现⼆义性 B.解决⼆义性可以⽤对成员名的限定法 C.⽗类和⼦类中同时出现同名函数,也可能存在⼆义性 D.⼀个⼦类是从两个⽗类派⽣出来的,⽽这两个⽗类⼜有⼀个共同的⽗类,对该⽗类成员进⾏访问时,可能出现⼆义性 【参考答案】 C 18.函数模板:template T add(T x,T y) {return x+y;} 下列对add函数的调⽤不正确的是( ) A.add< >(1,2) B.add(1,2) C.add(1.0,2) D.add(1.0,2.0) 【参考答案】 C 19.this指针是C++实现什么的⼀种机制?( ) A.抽象 B.封装 C.继承 D.重载 【参考答案】 B 20.下列程序的输出结果是( ) #include class Myclass{ public:Myclass(int i=0,int j=0) { y=j; } void show(){cout< void show()const{cout< privated: int x;int y; }; 考试⼤(www.Examda。

2013级VC课程设计题目

2013级VC课程设计题目

2013级VC课程设计题目2013级计算机科学与技术专业《面向对象程序设计》课程设计题目1、吹泡泡游戏【问题描述】:当用户在窗口客户区中单击鼠标左键时,即可产生一个泡泡(图形)。

既要求产生不同的颜色的大小随机的泡泡,又要能使这些泡泡升起或降落,最后消失。

【基本要求】:1)在屏幕上画一个矩形框,开始为空白。

2)当鼠标的左键单击矩形框内的任何位置时,在该位置产生1个随机大小的红色泡泡(实心园),并开始下降。

3)当鼠标的右键单击矩形框内的任何位置时,在该位置产生1个随机大小的蓝红泡泡(实心园),并开始上升。

4)上升或下降到矩形框边界时,泡泡自行消失5)矩形框右边显示当前矩形框中红色/蓝色泡泡的正确数目6)矩形框内应可以同时容纳多个泡泡(100个以上)7)各泡泡在漂移过程中还会改变形状【实现提示】每个泡泡的大小用一个CRECT对象来存储,可以使用一个CRECT 数组来存储一组红色泡泡的大小信息。

再使用一个布尔数组来存储泡泡的状态信息。

这两个数组是相对应的。

当布尔值为FLASE时,表示该位置没有存储泡泡。

反之亦然。

产生一个新的泡泡时,依次搜索布尔数组,找出第一个FLASE的位置,存储新的泡泡。

每隔一定的时间,更新泡泡的大小和位置,使泡泡运动增大。

2、壁球游戏【问题描述】:屏幕上有一个球场,球场中央有一个球,以随机方向运动,遇到左、右、上方的墙壁可以反弹,如球落到地面则游戏结束。

在屏幕下方有一球拍(侧面形状为一很扁的矩形),球遇到球拍后也可以反弹。

球拍由左、右方向键控制,以防落到地面。

【基本要求】:1)球场、球拍和球显示比例合理、色彩美观大方;2)球的运动方向随机,可以任意角度斜向运动,反弹方向合理(入射角等于反射角);3)可以用左右方向键控制球拍左右移动;用“难度”菜单设置难度,速度越高,球拍越短,则难度越大;4)按下菜单选项“开始”,球开始运动,球接触地面游戏结束5)球每遇到墙壁或球拍反弹一次计10分,并显示当前得分【实现提示】1)直接用角度m_nballDirection来表示小球随机运动在360度的范围的任意的角度2)垂直向下的方向角度为0,逆时针旋转,可以计算出小球在水平和垂直两个方向运动的偏移量,并由三角函数的性质,直接和原来的位置坐标相加就可以得到新的位置坐标(无需考虑计算结果的符号)3)小球运动到边界时,分两种情况来考虑A 当从上、下(球拍)两边界反弹时,新的角度为180-m_nballDirection,从左、右两边界反弹时,新的角度为360-m_nballDirection。

2013学考真题及答案

2013学考真题及答案

第一套有Visual Basic程序段如下:x = -3Do While x < 0x = x + 2Loop该程序段运行后,变量x的值是A. -3B. -1C. 1D. 3某电影的评价如图所示:图中的评价方式属于A. 个人推荐B. 统计评价C. 专家推荐D. 核心刊物评价某Flash作品的部分编辑界面如图所示:完整播放该场景一次需要5秒,如果要让播放时间延长到10秒,可以将帧频设置为A. 3.0fpsB. 6.0fpsC. 12.0fpsD. 24.0fps制作一段音频,在其他指标都相同的情况下,分别采用以下4种设置,其中音质最佳的是A. 单声道,8位量化 B. 立体声,8位量化C. 单声道,16位量化D. 立体声,16位量化在Word软件中输入“旁证博引”时,发现期立即变为“旁征博引”,这是因为Word软件具有A. 查找功能B. 自动更正功能C. 批注功能D. 修订功能某用户电子邮件的设置如图所示:对该设置有如下说法:①邮件发送后被保存到“已发送”文件夹②该邮件以加密方式进行发送③邮件发送后,会收到短信提醒其中正确的有A. ①②B. ①③C. ②③D. ①②③使用UltraEdit软件观察字符内码,结果如图所示:则存储字符“#正能量#”需要的字节数是A. 4B. 5C. 7D. 8用Photoshop软件制作一幅1024×512像素的图片,存储为BMP格式文件时,选项界面如图所示:该图像文件存储容量约为A. 375KBB. 750KBC. 1.5MBD. 3MB小马要制作“放飞梦想”为主题的多媒体作品,在规划与设计阶段,设计整个作品的组成部分、工作流程、主要界面。

这一环节属于A. 需求分析B. 结构设计C. 模块设计D. 脚本编写某用户微博的相关统计如图所示图中的“围观”数主要体现了该用户微博信息的A. 安全性B. 真伪性C. 共享性D. 载体依附性第二套使用UltraEdit软件观察字符内码,结果如图所示:则字符“TOP3”的内码是A. 54 4F 50 30B. 54 4F 50 31C. 54 4F 50 32D. 54 4F 50 33小夏某次网络购物的支付操作部分界面如图所示:由图可知,他在支付过程中使用了手机校验码,其目的主要是为了提高A. 支付的安全性B. 手机号码的安全性C. 手机的使用频率D. 校验码的使用频率OCR软件主要用于A. 语音识别B. 字符识别C. 人脸识别D. 指纹识别下列能表示“x与y都小于10”的Visual Basic逻辑表达式是A. (x < 10) And (y < 10)B. x < 10 , y < 10C. (x < 10) Or (y < 10)D. X < 10 : y < 10小黄要拍摄一些学校风景照片,并对拍摄的照片进行处理,下列采集工具、加工软件可实现这一功能的是A. 数码相机、PhotoshopB. 扫描仪、GoldWaveC. 数码摄像机、GoldWaveD. 手机、Access使用浏览器软件打开某网页文件如图所示:对该网页文件分析如下:①文件名为“dzys.htm”②文件名为“冬至养生”③可使用“记事本”软件编辑④可使用“ACDSee”软件浏览A. ①④B. ①③C. ①③④D. ②③④某多媒体作品的发布方式设置如图所示:按此设置进行发布,则生成的文件有A. “spring.swf”和“spring.html”B. “spring.gif”和“spring.exe”C. “spring.jpg”和“spring.exe”D. “spring.swf”和“spring.mov”使用Access软件创建一张数据表,其结构如图所示:在该数据表中录入数据时,下列操作能实现的是A. 在“商品编号”字段中输入“20131801”B. 在“商品名称”字段中输入“电视机”C. 在“生产日期”字段中输入“2013\3\1”D. 在“库存”字段中输入“25台”使用GoldWave软件编辑某音频文件时,部分界面如图所示:若要删除选中部分的音频,可以使用的按钮是A. B. C. D.使用一个存储容量为1024MB的U盘,来存储未经压缩的1280×968像素、32位色BMP图像,可以存储这种图像大约为A. 800张B. 400张C. 200张D. 20张第三套有关计算机病毒及防护,下列说法正确的是A. 病毒一般可以隐藏在文件中B. 不同杀毒软件的病毒库都可以通用C. 安装正版杀毒软件后就能查杀一切病毒D. 病毒都不会破坏系统资源使用“会声会影”软件制作作品时,部分操作界面如图所示:下列描述正确的是A. “活动一.mpg”视频素材播放完毕时,标题“我的暑假”才开始出现B. “活动一.mpg”视频素材与标题“我的暑假”同时播放完毕C. “活动一.mpg”视频素材与“背景音乐.mp3”同时开始播放D. “活动二.mpg”视频素材与“背景音乐.mp3”同时开始播放某公司研发的一款语音翻译软件,能将用户说的话翻译成其他语言。

2013年计算机二级考试C++模拟试题及参考答案

2013年计算机二级考试C++模拟试题及参考答案

2013年计算机二级考试C++模拟试题及参考答案2013年计算机二级考试C++模拟参考答案一、选择题1.栈和队列的共同特点是A)都是先进先出B)都是先进后出C)只允许在端点处插入和删除元素D)没有共同点【参考答案】C2.已知二叉树后序遍历序列是dabec,中序遍历序列是debac,它的前序遍历序列是A)acbedB)decabC)deabcD)cedba【参考答案】 D3.链表不具有的特点是A)不必事先估计存储空间 B)可随机访问任一元素C)插入删除不需要移动元素 D)所需空间与线性表长度成正比【参考答案】 B4.结构化程序设计的3种结构是A)顺序结构、选择结构、转移结构B)分支结构、等价结构、循环结构C)多分支结构、赋值结构、等价结构D)顺序结构、选择结构、循环结构【参考答案】 D5.为了提高测试的效率,应该A)随机选取测试数据B)取一切可能的输入数据作为测试数据C)在完成编码以后制定软件的测试计划D)集中对付那些错误群集的程序【参考答案】 D6.算法的时间复杂度是指A)执行算法程序所需要的时间 B)算法程序的长度C)算法执行过程中所需要的基本运算次数D)算法程序中的指令条数【参考答案】 C7.软件生命周期中所花费用最多的阶段是A)详细设计B)软件编码C)软件测试D)软件维护【参考答案】 D8.数据库管理系统DBMS中用来定义模式、内模式和外模式的语言为A)CB)BasicC)DDLD)DML【参考答案】 C9.下列有关数据库的描述,正确的是A)数据库是一个DBF文件B)数据库是一个关系C)数据库是一个结构化的数据集合D)数据库是一组文件【参考答案】 C10.下列有关数据库的描述,正确的是A)数据处理是将信息转化为数据的过程B)数据的物理独立性是指当数据的逻辑结构改变时,数据的存储结构不变C)关系中的每一列称为元组,一个元组就是一个字段D)如果一个关系中的属性或属性组并非该关系的关键字,但它是另一个关系的关键字,则称其为本关系的外关键字【参考答案】 D11.C++语言对C语言做了很多改进,C++语言相对于C语言的最根本的变化是A)增加了一些新的运算符B)允许函数重载,并允许设置缺省参数C)规定函数说明符必须用原型D)引进了类和对象的概念【参考答案】 D12.下列哪个是C++语言的有效标识符?A)_No1B)No.1C)12345D)int【参考答案】 A13.设有定义int x;float y;,则10+x+y值的数据类型是A)intB)doubleC)floatD)不确定【参考答案】 B14.下列程序的执行结果为#includevoid main(){ int a=3,b=0;int *p=&ab=+a++;cout<<*p<<","<A)3,4B)4,3C)3,4D)4,4【参考答案】 B15.下面程序的运行结果为#includevoid main(){ for(int a=0,x=0;!x&&a<=10;a++) { a++; }cout<A)10B)11C)12D)0【参考答案】 C16.下列选项,不正确的是A)for(int a=1;a<=10;a++);B)int a=1;do{ a++; }while(a<=10)C)int a=1;D)for(int a=1;a<=10;a++)a++; while(a<=10){ a++; }【参考答案】 B 这个这样看还不能乱来。

2013-C++第13周班级对抗赛题目及参考解答

2013-C++第13周班级对抗赛题目及参考解答

2013-C++第13周班级对抗赛题⽬及参考解答Problem A 她胖吗?Description奚嘉嘉是位爱美的⼥孩,⾝⾼165cm,体重52.5kg,可还是为保持⾝材错过了好多⼝福。

实际上,保持健康和快乐,⽆论胖瘦都是美。

当然太胖或太瘦可能对健康不利,适当注意即可。

我们要为奚嘉嘉这样的爱美⼥孩设计⼀个程序,提供⾝体、体重,给出建议。

⼥性的标准体重是:⾝⾼(厘⽶)-100= 标准体重(公⽄),超过标准体重20%以上者为肥胖,低于标准体重20%的为偏瘦,在肥胖与偏瘦之间为正常。

Input⾝⾼(cm)与体重(kg)值,⾝⾼整数,体重是⼩数Output肥胖时输出high,正常时输出normal,偏瘦要输出low。

(注意全⽤⼩写)Sample Input165 52.5Sample Outputnormal参考解答:#include <iostream>#include<cstdio>#include <iomanip>using namespace std;int main(){cin>>height>>weight;st = height - 100;if(weight/st>1.2)cout<<"high\n";else if((weight/st<0.8))cout<<"low\n";elsecout<<"normal\n";return 0;}Problem B 股市风云Description股市强烈动荡,有涨有跌。

现在有⼀组数据表⽰各公司的涨跌(涨为正,跌为负,不动为零),要求统计出平均涨幅和平均跌幅。

Input⼀组数,其中有正数,也有负数,还有0。

输⼊的个数不定,另外,不会出现只有正数或只有负数的情况。

Output第⼀⾏输出见涨的数⽬和遇跌的数⽬;第⼆⾏输出平均涨幅(正数的平均数)和平均跌幅(负数的平均数,再取反),保留⼩数点后3位。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

C++模拟试卷与答案(仅供参考)一、填空:1、面向对象的三大特性是封装、继承、多态性。

2、windows系统提供的标准控件主要包括:按钮控件、滚动条控件、列表框控件、静态控件、编辑框控件和组合框控件等。

3、同属一个类的对象具有相同的属性和方法。

4、任何类中允许有三种属性的数据,它们是private、public和protected。

5、静态数据成员在定义或说明时候前面加上关键字static ,内联函数关键字inline。

6、如果没有提供一个类的构造函数(一个都未提供),则C++提供一个缺省的构造函数。

7、在Windows应用程序中可以使用几种不同类型的资源,它们包括:加速键、位图、图标、对话框、菜单、工具条和字符串等。

8、如果在定义一个类时,没有显示地定义析构函数,则清除对象的工作将由缺省的析构函数来完成,这是因为对于大多数的类来说缺省的析构函数就能满足要求。

9、当在程序中声明一个派生类的对象时,首先调用的是基类的构造函数,然后调用派生类的构造函数。

10、C++语言提供了两种类型的重载,分别是函数重载和操作符重载。

二、选择题:1、有关类的说法不正确的是(D)A、类是一种用户自定义的数据类型B、只有类中的成员函数才能存取类中的私有数据C、在类中,不作特别说明,所有的数据均为私有类型D、在类中,如果不作特别说明,所有的成员函数均为公有类型2、下列各类函数中,______不是类的成员函数。

(C)A、构造函数B、析构函数C、友元函数D、拷贝构造函数3、下列静态数据成员的特性中,_____是错误的。

(D)A、说明静态数据成员时前边要加修饰符staticB、静态数据成员要在类体外进行初始化C、引用静态数据成员时,要在静态数据成员名前加<类名>和作用域运算符D、静态数据成员不是所有对象所共用的4、友元的作用_________.(A)A、能提高程序的运行效率B、加强类的封装性C、实现数据的隐藏性D、增加成员函数的种类5、若Queue是类,aQueue是它的一个对象,p1是类对象aQueue的一个指针,那么类对象aQueue可以通过_____来访问类的成员,类对象aQueue的指针p1可以通过____来访问类的成员。

(B)(D)A、::B、 .C、;D、6、有关析构函数的说法不正确的是(C)A、析构函数有且只有一个B、析构函数无任何函数类型C、析构函数和构造函数一样可以有形参D、析构函数的作用是在对象被撤销时收回先分配的内存空间7、运行时多态通过使用(C)获得。

A、继承B、重载函数C、虚函数D、析构函数8、已知:print()函数是一个类的常成员函数,它无返回值,下列表示中,____是正确的(A)A、void print() constB、const void print()C、void const print()D、void print(const)9、关于new运算符的下列描述中,______是错误的。

(C)A、它可以用来动态创建对象和对象数组B、使用它创建对象或对象数组,可以使用运算符delete删除C、使用它创建对象时要调用构造函数D、使用它调用对象数组时不许指定初始值10、运行下面的程序,其输出结果正确的是(D)A、6B、9C、17D、32 源程序如下:#include<iostream.h>int main(){ int k=6,n=0;while (k>0){ switch(k){ case 1: n+=k:; //注意:每个case语句后没有break语句。

case 2:case 3: n+=k;case 4: n+=k;case 5: n+=k;}k--;}cout<<n<<endl;return(0);}1、请在下列划线处填上合适的语句,然后给出合理的输出结果#include<iostream.h>#include<math.h>class TPoint{private:double x,y;public:TPoint(double a,double b){x=a;y=b;cout<<"点:("<<x<<","<<y<<")"<<endl;}friend double distance(TPoint a,TPoint b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}};void main(){TPoint p1(200,100),p2(500,500);cout<<"上述两点间的距离"<<distance(p1,p2)<<endl; }输出结果:点:(200,100)点:(500,500)上述两点间的距离5002、在下面程序横线处填上适当的字句,并输出结果#include<iostream.h>class base{public:virtual int func(){ return 0; }};class derived:public base{public:int a,b,c;void setValue(int x,int y,int z){a=x;b=y;c=z;}int func(){return(a*(b+c)*a);}};void main(){base b;derived d;cout<<b.func()<<",";d.setValue(3,4,5);cout<<d.func()<<",";base &pb=d;cout<<pb.func()<<endl;}输出结果:0,81,811、请把下面程序的结果输出到空白处#include<iostream.h>class B{int x,y;public:B(){ x=y=0;cout<<"Constructor1"<<endl;}B(int i){ x=i;y=0;cout<<"Constructor2"<<endl;}B(int i,int j){ x=i;y=j;cout<<"Construcor3"<<endl;}~B(){ cout<<"Destructor"<<endl;}void print(){cout<<"x="<<x<<",y="<<x-y<<endl;}};void main(){B *ptr;ptr=new B[3];ptr[0]=B();ptr[1]=B(50);ptr[2]=B(12,13);for(int i=0;i<3;i++)ptr[i].print();delete[]ptr;}输出结果:Constructor 1Constructor 1Constructor 1Constructor 1DestructorConstructor 2DestructorConstructor 3Destructorx=0,y=0x=50,y=50;x=12,y=-1;DestructorDestructorDestructor2、请把下面程序的结果输出到空白处#include<iostream.h>class Tc{private:int A;static int B;public:Tc(int a){A=a;B+=a;}static void display(Tc c){cout<<"A="<<c.A<<"B="<<c.B<<endl;}};int Tc::B=20;void main(){Tc A(4),B(5);Tc::display(A);Tc::display(B);}输出结果:A=4B=29A=5B=294、请把下面程序的结果输出到空白处#include<stdio.h>int a[]={1,3,5,7,9};int *p[]={a,a+1,a+2,a+3,a+4};\\其中a 是a数组的首地址,p[i]中存放的是地址void main(){printf("%d\t%d\t%d\n",a[4],*(a+2),*p[1]);\\p[1]中是地址,*p[1]是地址所指的变量printf("%d\t%d\t%d\n",**(p+1)+a[2],*(p+4)-*(p+0),*(a+3)%a[4]);\\*(p+1)是地址,**(p+1)是地址*(p+1)所指变量}L=输出结果:9 5 38 4 7五、编程题:1、通过三角形的三条边可以计算出三角形的面积,通过梯形的上底、下底和高的值可以计算出梯形的面积,通过长方体的长、宽、高的值可以计算出长方体的体积。

设计一个object 类来管理三个数据,从此类派生三角形类triangle ,梯形类trapezia和长方体类cubold,并求三角形、梯形的面积和长方体的体积,请编写以上程序。

(注:数据从健盘输入)#include<iostream.h>#include<math.h>class object{protected:int x,y,z;public:void getdata(){cout<<"分别为x,y和z"<<endl;cin>>x>>y>>z;}};class triangle:public object{public:void getdata(){cout<<"请输入三角形三条边长";object::getdata();}double area(){double d=(x+y+z)/2;if(d<=x||d<=y||d<=z){cout<<"三条边不能构成三角形"<<endl;return NULL;}double s=sqrt(d*(d-x)*(d-y)*(d-z));return s;}};class trapezia: public object{public:void getdata(){cout<<"请输入梯形的下底、上底和高";object::getdata();}double area(){double s=(double)(x+y)*z/2;return s;}};class cuboid:public object{public:void getdata(){cout<<"请输入长方体的长、宽、高";object::getdata();}double volume(){double v=x*y*z;return v;}};void main(){triangle A;A.getdata();cout<<"三角形的面积为:"<<A.area()<<endl;trapezia B;B.getdata();cout<<"梯形的面积为:"<<B.area()<<endl;cuboid C;C.getdata();cout<<"正方体的体积为:"<<C.volume()<<endl;}2、编写重载函数circle()分别计算圆、矩形和三角形的边界长度,其函数首部为:double circle(double r)double circle(double a,double b)double circle(double a,double b,double c)在主函数main()中,依次计算如下图的边界长度:1)半径为10圆形。

相关文档
最新文档