if语句练习题
if从句练习题

if从句练习题if从句练习题if从句是英语中非常重要的语法结构之一,它用来表达假设、条件和可能性。
掌握好if从句的用法和运用,对于提高英语的表达能力至关重要。
下面我将给大家提供一些if从句的练习题,希望能帮助大家更好地理解和运用这一语法结构。
练习一:完成下列句子,使用正确的if从句形式。
1. 如果我有足够的时间,我会去看电影。
2. 如果你不努力学习,你就不能通过考试。
3. 如果天气好,我们将去郊游。
4. 如果我是你,我会接受这个机会。
5. 如果我有钱,我会买一辆新车。
练习二:根据给定的情境,完成下列句子,使用正确的if从句形式。
1. 你想要改变现状吗?如果是的话,你应该努力工作。
2. 如果你不告诉我真相,我将无法帮助你。
3. 如果你不早点出发,你会迟到的。
4. 如果你不小心,你会摔倒的。
5. 如果你不去医院,你的病情可能会恶化。
练习三:根据给定的情境,完成下列句子,使用正确的if从句形式。
1. 如果你明天有空,我们可以一起去看电影。
2. 如果你不快点,我们将会错过火车。
3. 如果你不知道答案,你可以向老师请教。
4. 如果你不喜欢这个菜,我可以给你换一个。
5. 如果你迷路了,你可以问路人。
练习四:根据给定的情境,完成下列句子,使用正确的if从句形式。
1. 如果我有机会,我会去旅行。
2. 如果你不小心,你会弄丢钱包的。
3. 如果你不吃早餐,你会感到饿的。
4. 如果你不学习,你将无法通过考试。
5. 如果你不努力工作,你就不能取得成功。
练习五:根据给定的情境,完成下列句子,使用正确的if从句形式。
1. 如果你不锻炼,你的健康状况会变差。
2. 如果你不按时交作业,老师会扣分的。
3. 如果你不小心驾驶,你会出事故的。
4. 如果你不学会这个技能,你将失去这个机会。
5. 如果你不好好休息,你会感到疲劳的。
通过以上练习题,我们可以更好地理解和掌握if从句的用法。
if从句在表达假设、条件和可能性时非常常用,因此我们应该多加练习和运用,以提高我们的英语表达能力。
If 练习百题

If 用法练习100题1. We will go shopping if it____ tomorrow.A don't rain B. didn't rain C. doesn't rain D. isn't rain2. The girls asked if they ____ some food and drink with them. A. took B. take C. takes D. will take3. She asked Linda if___ go and get some. A. could she B. she could C. she can D. she may4. I don't know _____ they have passed the exam. A. what B. if C. when D. where5. She didn't know______ back soon.A. whether he would beB. if would he beC. he will beD. if he will come6.I don't know _____ he still lives here after so many years. A. whether B where C. what D. when7.She asked me if I knew ______A. whose pen is itB. whose pen it wasC. whose pen it isD. whose pen was it8.He said ______ there was going to be a meeting that evening. A. what B. if C. that D. how9. The girls asked if they ____ some food and drink with them.A. tookB. takeC. takesD. will take10. The students would have made better grades if they _______hard.A. studyB. studiedC. had studiedD. studying11.Hundreds of jobs _______ if the factory closes.A. loseB. will be lostC. lostD. will lose12. I'll have to push the car to the side of the road because we ____if we leave it here.A. would be finedB. will be finedC. will being finedD. will have been fined13. If one ________by pride, he will reject useful advice and friendly assistance.A. overcomesB. is overcomeC. has been overcomeD. overcome14. Y ou’re at a party and someon e asks if you _______ a good time.A. haveB. hadC. are havingD. will have15. If she had worked harder, she _____ better in the examination.A. might have doneB. had doneC. could doD. should do16. If we meet with a new word ,don't forget to _______in the dictionary.A. look up itB. look for itC. look it upD. look after it17. If you __________here yesterday you would have seen the famous actor.A. wereB. has beenC. had beenD. would be18. _________no electronic computers, they could have been no satellites or rockets.A. Had there beenB. If there wereC. Should there beD. If there are19. ____________,Sam would have been able to pass the exam.A. If he studies moreB. If he were studying to a greater degreeC. Studying moreD. Had he studies more20. If he ________ his homework, Frank can go out for a walk.A. will finishB. finishesC. finishD. to finish21. There will be a lot of spare time if it _________ tomorrow.A. rainsB. rainC. will rainD. is going to rain22. ____ environmental damage is done, it takes many years for the ecosystem to recover.A. Even ifB. If onlyC. WhileD. While23. My parents were quarrelling about me ____ I could not quite tell why.A. sinceB. thoughC. ifD. until24. It is known to all that ____ you exercise regularly, you won’t keep good health.A. unlessB. wheneverC. althoughD. if25. In time of serious accidents, ___ we know some basic things about first aid, we can savelives. A. whether B. until C. if D. unless26. How can you expect to learn anything ____ you never listen?A. in caseB. even ifC. unlessD. when27. We don’t keep winning games ____ we keep playing well.A. becauseB. unlessC. whenD. even if28. ----I have never spoken ill of Mary. ---- you don’t like her.A. IfB. BecauseC. So thatD. Though29. Allow children the space to voice their opinions, they are different from your own.A、until B. even if C. unless D. as though30. ----Will you go to attend her birthday party? ----No, invited to.A. ifB. untilC. whenD. even though31. Y ou must keep on working in the evening, you are sure you can finish the task in time.A、asB、ifC、whenD、unless32. _____ the expense, I _____ to Italy.A. If it were not, goB. Were it not for, would goC. Weren't it for, will goD. If it hadn’t been, would have gone33. If you don't feel well, you may just ___ .A. stopped readingB. stop readingC. stopped to readD. stop to read34. They treated her very well ____one of the family members.A. like B. as C. as if D. seems35. After he won all the money they treated him __a king. A. like B. as C. as if D. seemed36. –Does it matter if I give it up this time? -- It ____if you do. Y ou won’t have ______chance.A. does; the otherB. does ; secondC. does matter; anotherD. does matter; the other37. 1. ____ it rains, the game will be played on time.2. ____ I was twenty, I had never been away from my hometown.3. ____ he were there, he couldn’t help us.A.Even ifB. UntillC. TillD. Unless38. If only he _____ me yesterday! A. had seen B. would see C. should see D. saw39. If you _____ wait a moment, I’ll go and find our manager. A. can B. should C. will D. must40. If I _____ you, I _____ more attention to English idioms and phrases.A. was; shall payB. am; will payC. would be; would payD. were; would pay41. —Who is the girl standing over there? —Well, if you _____ know, her name is Mabel.A. mayB. canC. mustD. shall42. We might have failed if you us a helping hand.A.have not given B.would not give C.had not given D.did not give43. If there were no subjunctive mood,English much easier.A.will be B.would have been C.could have been D.would be44. Y ou are late.If you a few minutes earlier, you him.A.came;Would meet B.had come;Would have metC.come;Will meet D.had come;would meet45. The two strangers talked as if they friends for years.A.should be B.had been C.have been D.were46. If we had not missed the bus,we lunch at home now.A.would have had B.would have C.must be having D.would be having 47. here yesterday,he would attend the lecture with us today.A.Had he been B.If he were C.Were he D.Should be he48. O ur chairman hasn’t come yet.If he on time,we would have to put off the meeting.A.should come B.would come C.shouldn’t come D.doesn’t come49. I her if I thought she would understand.A.would tell B.will tell C.Would have to1d D.told50. —If he ,he that food.—Luckily he was sent to the hospita1 immediate1y.A.Was warmed;would not take B.had been warmed;wou1d not have taken C.would be warmed;had not taken D.would have been warmed;had not taken51. Wouldn't it be ___wonderful world if all nations lived in ___peace with one another?A. a; /B. the; /C. a; theD. the; the52. If I ____ where he lived, I ____ a note to him.A. knew, wouldB. had known, would have sentC. know, would sendD. knew, would have sent53. I didn’t know his telephone number. ____ it, I ____ then.A. Had I known, would ring him upB. Should I know, would have rung him upC. If I knew; would ring him upD. Had I known; would have rung him up54. Mary is ill today. If she _____ , she ____ absent from school.A. were not ill; wouldn’t beB. had been ill; wouldn't have beenC. had been ill; should have beenD. hadn't been ill; could be55. Were I to do it, I ________ it some other way.A. will doB. would doC. would have doneD. were to do56. I ________ him the answer ________ possible, but I was so busy then.A. could tell; if it had beenB. must have told; were itC. should have told; had it beenD. should have told; should it be57. If they ____ earlier than expected, they ____ here now.A. had started, would beB. started, might beC. had started, would have beenD. will start, might have been58. He acted as if he ________ everything in the world.A. knewB. knowsC. has knownD. won't know59. If only I _________ to the lecture! A. listen B. will listen C. am listening D. had listened60. --- If he_____ , he ______ that food. ---- Luckily he was sent to the hospital immediately.A. was warned; would not takeB. had been warned; would not have takenC. would be warned; had not takenD. would have been warned; had not taken61. I didn’t see your sister at the meeting. If she _________, she would have met my brother.A. has comeB. did comeC. cameD. had come62. If city noises _______ from increasing, people _______ shout to be heard even at the dinner table 20 years from now. A. are not kept; will have to B. are not kept; have toC. do not keep; will have toD. do not keep; have to63. If you had enough money, what ________ ?A. will you buyB. would you buyC. would you have boughtD. will you have bought64. If you ________ that film late last night, you wouldn't be so sleepy.A. didn't seeB. haven't seenC. wouldn’t have seenD. hadn’t seen65. I'm going anyway. _____ she will go is up to her to decide.A. If or notB. Whether or notC. IfD. That66. It is still a question _____ we shall have our sports meet. A. if B. that C. what D. when67. It has been decided _____ he will be sent there. A. if B. whether C. why D. that68. It doesn’t matter _____he' s come back or not. A. if B. whether C. that D. when69. ____ the 2000 Olympic Games won't be held in Beijing is known to all.A. WhetherB. IfC. WheneverD. That70. It looked ____.A. as if it was going to rainB. that as if it was going to rainC. as if was it going to rainD. as if that it was going to rain71. My suggestion is _____ we should send a few comrades to help them.A. ifB. thatC. when thatD. that where72. The fact _____ he hadn’t said anything surprised us all. A. why B. if C. that D. whether73. Father made a promise ____ I passed the exam, he would buy me a bicycle.A. thatB. ifC. whetherD. that if74. There is no doubt ____ my friend was not important to them all.A. thatB. whetherC. ifD. why75. If we don’t start out now, we must risk ______ the train.A. miss B missing C. being missed D to miss76. Give me one more minute ____ I’ll be able to finish it.A. andB. orC. ifD. so77. ---- I’d really like some lunch but I have so much work to do.---- ____ what you want and I can get it for you.A. Tell meB. If you would say to meC. Y ou will tell meD. If you tell me78. If they _________ to do this work, he might do it some other way.A. wereB. shouldC. willD. can79. If you were in an English-speaking country, you, too, _________ English every day.A. will be used to speakB. will be used to speakingC. must be used to speakD. would be used to speaking80. ___the headmaster comes, we won’t discuss this plan.A. UnlessB. If notC. ExceptD. Whether81. Don’t be discouraged ________you have fallen behind others.A. whetherB. as ifC. even ifD. however82.We can get there on time ______the car doesn’t break down.A. whileB. as long asC. so thatD. even if83. I’ll start early, _______it may be dark. A. however B. whether C. if D. though84. We shouldn’t do that dangerous experiment _____the teacher is with as.A. if notB. ifC. unlessD. as long as85. This is a revision paper. When you do it, you’d better make a mark _______you have questions.A. whereB. the placeC. as ifD. since86. .--- Don’t look dow n upon Bob. He has his own advantages.--- Oh, yes. ____ others are weak, he is strong. A. If B. When C. Where D. Though87. John shut everybody out of the kitchen _____ he could prepare his grand surprise for the party.A. whichB. whenC. so thatD. as if88. They went on working ________ it was late at night.A. even ifB. as ifC. howeverD. as though89. --- Shall Brown come and play computer games?--- No,________ he has finished his homework. A. when B. if C. unless D. once90. I hurried ___ I wouldn’t be late for class. A. since B. so that C. as if D. unless91. --- Alice is moving to her new apartment next Saturday.--- I would be glad to help her,________ need some help.A. should sheB. if she willC. if sheD. if she might92. I wonder if I ________ time. If I ________ time,I’ll go with you.A. have;haveB. will have;will haveC. have;will haveD. will have;have93. --I’m going to the post office.--______ you're there. can you get me some stamps?A. AsB. WhileC. BecauseD. If94. The WTO can’t live up to its name _____it does not include a country that is a home to one fifth of mankind. A. as long as B. while C. if D. even though95. John shut everybody out of the kitchen _____ he could prepare his grand surprise for the party.A. whichB. whenC. so thatD. as if96. Y ou will be late _____ you leave immediately. A. unless B. until C. if D. or97. I would appreciate it _______ you call back this afternoon for the doctor’s appointment.A. untilB. ifC. whenD. that98. The company has a free long-distance telephone number _____ customers may call with any questions they have about its products. A. although B. as C. even if D. so that 99. ______ the Internet is bringing the distance between people, it may also be breaking some homes or will cause other family problems.A. When B. If C. As D. While 100. The meeting didn't start___ everyone was there. A. because B. until C. why D. if101.May I sit nearer___ I can see more clearly? A. as if B. so that C. even if D. so102 ___ you work hard, you will certainly succeed. A. Though B. If C. Because D. For103. I want to know ___ she is going to see a film. A. if B. that C. what D. which104. Y ou are sure to pass the exam ___ you study hard. A. if B. though C. that D. since105. I'll go to see the film with you___ I have time this evening. A. whether B. so C. if D. when 106. ___ you study harder, you'll never pass the final exam. A. If B. Until C. Unless D. Except 107. The dictionary is so expensive ___ I can't buy it. A. because B. when C. that D. if 108. All plants need air _______they need water. A.like B.as if C.as D.so 109. The old professor worked many hours a day _______he became seriously ill.A. althoughB. even ifC. thoughD. until110. Y ou must keep on working in the evening _______ you are sure you can finish the task in time.A. asB. ifC. whenD. unless111. Allow children the space to voice their opinion, ______ they are different from your own.A. untilB. even ifC. unlessD. as though112. _____ no subjunctive mood, English would be much easier.A. If were thereB. If there wereC. Were thereD. Is there 113. _____ no subjunctive mood, English would be much easier.A. If were thereB. Were if thereC. Were thereD. Is there1) This is an illness that can result in total blindness ______ left untreated.(2) ______ you want me to fire you, I suggest you stop wearing sports clothes at office.(3) You must keep on working in the evening ______ you are sure you can finish the task in time.A. sinceB. ifC. unlessD. until。
(完整版)if虚拟语气练习题及答案

(完整版)if虚拟语气练习题及答案如果虚拟语气练习题是一种能够帮助我们巩固和加深对于虚拟语气的理解的方法。
通过解答这些练习题,我们可以更好地掌握虚拟语气的用法,并提高在语言表达中正确运用虚拟语气的能力。
下面提供一些虚拟语气练习题及答案,希望可以帮助大家加深对虚拟语气的认识。
练习题一:填空题根据句意,选择正确的虚拟语气形式填空。
1. 如果我______(知道)你的电话号码,我会给你打电话。
答案:知道2. 如果我______(是)你,我会接受这个机会。
答案:是3. 如果他______(尽力)的话,他会取得更好的成绩。
答案:尽力4. 如果我______(有)足够的钱,我会帮助他。
答案:有5. 如果我______(做)得更好一些,我就能拿到这个工作了。
答案:做6. 如果明天______(不下雨),我们可以去野餐。
答案:不下雨7. 如果他______(不是)这么懒,他就不会被开除了。
答案:不是8. 如果你______(去)采取行动,你将失去这个机会。
答案:去9. 如果他______(读)更多的书,他的知识会更丰富。
答案:读10. 如果我______(拥有)魔法,我将会改变世界。
答案:拥有练习题二:选择题选择最佳答案填空。
1. 如果我______(会)弹钢琴,我会给你弹一首歌。
a. 会b. 能c. 可以d. 有答案:a. 会2. 如果你______(是)我,你会怎么做?a. 是b. 是的c. 如果d. 可以答案:a. 是3. 如果明天______(没有)下雨,我们可以去郊游。
a. 没有b. 不下c. 不下雨d. 不来答案:c. 不下雨4. 如果他______(学习)更努力,他会取得更好的成绩。
a. 学习b. 学习了c. 学习过d. 学习到答案:a. 学习5. 如果我______(有)足够的钱,我会买一辆新车。
a. 有b. 拥有c. 会有d. 有着答案:a. 有练习题三:改错题找出下列句子中的错误,并进行改正。
英语if专题练习题

英语if专题练习题### If Conditionals Practice ExercisesConditional sentences are an essential part of English grammar, expressing different possibilities and outcomes based on certain conditions. Here are some exercises to help you practice using "if" in various scenarios.#### Exercise 1: Fill in the blanks with the correct form of the verb.1. If it rains tomorrow, we will stay at home.2. If you study hard, you will pass the exam.3. If she had known the truth, she would have told us.4. If he offers you a job, you should consider it.5. If I had enough money, I would travel around the world.#### Exercise 2: Rewrite the sentences using the correct "if" clause.1. We will go to the party if we finish our work early.- We will go to the party if we finish our work early.2. She would have been happy if she had received the gift.- She would have been happy if she had received the gift.3. They will help us if we ask them nicely.- They will help us if we ask them nicely.4. I would have called you if I had your number.- I would have called you if I had your number.5. He will be late if he misses the bus.- He will be late if he misses the bus.#### Exercise 3: Choose the correct answer to complete the sentences.1. If I had taken the medicine, I wouldn't have felt sick.- A) had taken B) take C) would take2. She will call you if she finds your phone number.- A) if she finds B) unless she finds C) because she finds 3. They will win the game if they practice more.- A) if they practice B) unless they practice C) because they practice4. I would have gone with you if I had known about the trip. - A) if I had B) if I have C) because I had5. He will succeed if he works hard.- A) if he works B) unless he works C) because he works#### Exercise 4: Write a short paragraph using "if" conditionals.Imagine you are planning a surprise party for your friend. Write a paragraph about what you would do if certain conditions were met.If our friend agrees to go out for dinner, we will set up the party at her house while she is away. If we can't get a hold of her, we will have to think of another plan. If she finds out about the surprise, it won't be as special, so we must ensure everyone keeps it a secret. If we manage to execute our plan perfectly, it will be a birthday party she will never forget.#### Exercise 5: Answer the following questions using "if" conditionals.1. What would you do if you won the lottery?2. How would you react if you were given a promotion at work?3. What would happen if it snowed heavily during the winter?4. What would you do if you had a day off without any plans?5. How would you feel if you were invited to a prestigious event?These exercises are designed to help you understand and apply "if" conditionals in various contexts. Practice makes perfect, so keep working through these exercises to improve yourEnglish skills.。
if条件句练习题及答案

if条件句练习题及答案一、选择题1. 如果明天不下雨,我们将去野餐。
A) If it doesn't rain tomorrow, we will go for a picnic.B) If it rains tomorrow, we will go for a picnic.C) If it will rain tomorrow, we will go for a picnic.D) If it rains tomorrow, we will not go for a picnic.2. 只有当我完成作业后,我才会看电视。
A) I will watch TV only after I finish my homework.B) I will watch TV only before I finish my homework.C) I will watch TV only while I finish my homework.D) I will not watch TV only after I finish my homework.3. 除非他道歉,否则我不会原谅他。
A) I will forgive him unless he apologizes.B) I will not forgive him unless he apologizes.C) I will forgive him if he does not apologize.D) I will not forgive him if he apologizes.4. 只要我们努力工作,我们就能成功。
A) We can succeed as long as we work hard.B) We can succeed unless we work hard.C) We can succeed if we do not work hard.D) We cannot succeed unless we work hard.5. 如果你饿了,冰箱里有食物。
if条件句练习题及答案

if条件句练习题及答案If条件句练习题及答案If条件句是英语语法中非常重要的一部分,它用来表达假设或条件。
以下是一些if条件句的练习题及答案,希望能帮助大家更好地掌握这一语法知识。
练习题一:用正确的if条件句填空。
1. If I __________ (have) enough money, I would buy a new car.2. If it __________ (rain) tomorrow, we will stay at home.3. If she __________ (study) harder, she would pass the exam.4. If he __________ (not be) late, we would have caught the train.答案:1. had2. rains3. studied4. had not been练习题二:选择正确的if条件句。
1. If I had studied harder, I __________ the exam.a) would have passedb) will passc) passd) passed2. If it rains tomorrow, we __________ our picnic.a) will cancelb) would cancelc) canceld) cancelled3. If you had told me earlier, I __________ helped you.a) willb) wouldc) would haved) had答案:1. a) would have passed2. a) will cancel3. c) would have练习题三:根据给定的情景写出合适的if条件句。
1. 你的朋友迟到了,你会怎么说?If you had left home earlier, you wouldn't have missed the bus.2. 你想和朋友一起去看电影,但天气可能会下雨,你会怎么说? If it rains tomorrow, we will stay at home and watch a movie.3. 你没有通过考试,你会怎么安慰自己?If I had studied harder, I would have passed the exam.答案:1. If you had left home earlier, you wouldn't have missed the bus.2. If it rains tomorrow, we will stay at home and watch a movie.3. If I had studied harder, I would have passed the exam.希望以上练习题和答案能帮助大家更好地理解和掌握if条件句的用法。
if条件状语从句练习题及答案

if条件状语从句练习题及答案If条件状语从句练习题及答案条件状语从句是英语中常用的一种从句结构,用来表示某个条件成立时,另一个事件或结果也将发生。
掌握条件状语从句的用法对于提高英语口语和写作能力非常重要。
下面将给出一些条件状语从句的练习题及答案,帮助读者更好地理解和掌握这一语法知识。
练习题一:1. If it rains tomorrow, ___________.2. She will be late for work if ___________.3. If I see him, ___________.4. If you don't study hard, ___________.5. If I were you, ___________.练习题二:1. If you ___________ to the party, please bring a gift.2. If I ___________ you, I would apologize.3. If she ___________ the exam, she will be very happy.4. If it ___________ tomorrow, we will go hiking.5. If he ___________ the bus, he will be late for the meeting.答案一:1. we will stay at home.2. she misses the bus.3. I will say hello.4. you will fail the test.5. I would study harder.答案二:1. come2. were3. passes4. doesn't rain5. misses通过以上练习题,我们可以发现条件状语从句的用法和特点。
首先,在条件状语从句中,通常使用的连词有if、unless、provided that等。
第5章_if语句练习题

第五章if语句练习题1.已知int x=10,y=20,z=30;以下语句执行后x,y,z的值是____ ____ _if(x>y)z=x;x=y;y=z;2.以下if语句语法正确的是________A.if(x>0)printf(“%f”,x)else printf(“%f”,-x);B.if(x>0){x=x+y;printf(“%f’,x);}else printf(“%f”,-x);C.if(x>0){x=x+y;printf(“%f”,x);}else printf(“%f”,-x);D.if(x>0){x=x+y;printf(“%f,x);}else printf(“%f”,-x);3.请阅读以下程序:main( ){int a=5,b=0,c=0;if(a=b+c)printf(“* * *\n”);elseprintf(“$ $ $\n”);}以上程序______A.有语法错不能通过编译B.可以通过编译但不能通过连接C.输出* * *D.输出$ $ $4.以下程序的运行结果是______main( ){int m=5;if(m++>5)printf(“%d\n”,m);else printf(“%d\n”,m--);}A. 4B. 5C. 6D. 75.当a=1,b=3,c=5,d=4时,执行完下面一段程序后x的值是______if(a<b)if(c<d) x=1;elseif(a<c)if(b<d)x=2;else x=3;else x=6;else x=7;A. 1B. 2C. 3D. 66.有一个函数关系见下表:下面程序段中能正确表示上面关系的是( )A. y=x+1;if(x>=0)if(x==0)y=x;else y=x-1;B. y=x-1;if(x!=0)if(x>0)y=x+1;else y=x;C. if(x<=0)if(x<0)y=x-1;else y=x;else y=x+1;D.y=x;if(x<=0)if(x<0)y=x-1;else y=x+1;7.以下程序的输出结果是______ main( ){int a=100,x=10,y=20,okl=5,ok2=0; if(x<y)if(!ok1)a=1;elseif(ok2)a=10;a=-1;printf(“%d\n”,a);}A.1B.0C.-1D.值不确定8.以下程序输出结果是_______ main( ){int x=2,y=-1,z=2;if(x<y)if(y<0) z=0;else z+=1;printf(“%d\n”,z);A.3B.2C.1D.09.以下不正确的语句为______A.if(x>y);B.if(x=y)&&(x! =0) x+=y;C,if(x! =y) scanf(“%d”,&x);else scanf(“%d”,&y);D.if(x<y){x++;y++;}10.阅读以下程序#include<stdio.h>main( ){float a, b;scanf(“%f”,&a);if(a<0.0)b=0.0;else if((a<0.5)&&(a!=2.0))b=1.0/(a+2.0);else if(a<10.0)b=1.0/a;else b=10.0;printf(“%f\n”,b);}若运行时输入2.0<回车>,则上面程序的输出结果是_____A.0.000000B.0.500000C.1.000000D.0.25000011.若运行时输入:16<回车>,则以下程序的运行结果是( )#include<stdio.h>main( ){int year;printf(“Input you year:”);scanf(“%d”,&year);if(year>=18)printf(“you$4.5yuan/xiaoshi”);else printf(“your$3.0yuan/xiaoshi”);}12.若运行时输入:2<回车>,则以下程序的运行结果是( )#include<stdio.h>main( ){char class;scanf(“%c”,&class);if(class==’1’)printf(“1st class postage is 19p”); elseprintf(“2nd class postage is 14p”);}13.若运行时输入:4.4<回车>,则以下程序的运行结果是( ) #include<stdio.h>main( ){float costprice,sellingprice;printf(“enter cost price $:”);scanf(“%f”,&costprice);if(costprice>=5){sellingprice=costprice+costprice*0.25;printf(“selling price(0.25)$%6.2f”,sellingprice);}else{sellingprice=costprice+costprice*0.30;printf(“selling price(0.30)$%6.2f”,sellingprice);}}14.以下程序的运行结果是( )main( ){ if(2*2= =5<2*2= =4) printf(“T”);else printf(“F”);}15.请阅读以下程序:main( ){int t,h,m;scanf(“%d”,&t);h=(t/100)%12;if(h= =0) h=12;printf(“%d:”,h);m=t%100;if(m<10)printf(“0”);printf(“%d”,m);if(t<1200||t= =2400)printf(“AM”);else printf(“PM”);}若运行时输入:1605<回车>时,程序的运行结果是( )16.以下程序实现:输入圆的半径r和运行标志m,按照运行标志进行指定计算.请在( )内填入正确的内容. 标志运算a 面积c 周长b 二者均计算#define pi 3.14159main( ){char m;float r,c,a;printf(“input mark a c or b&&r\n”);scanf(“%c%f”,&m,&r);if( ){a=pi*r*r;printf(“area is %f”,a);}if( ){c=2*pi*r;printf(“circle is %f”,c);}if( ){a=pi*r*r;c=2*pi*r;printf(“area&&circle are%f%f”,a,c);}}17.若运行时输入:5999<回车>,则以下程序的运行结果(保留小数后一位)是( )main( ){int x;float y;scanf(“%d”,&x);if(x>=0&&x<=2999)y=18+0.12*x;if(x>=3000&&x<=5999)y=36+0.6*x;if(x>=6000&&x<=10000)y=54+0.3*x;printf(“%6.1f”,y);}18.以下程序实现输出x,y,z三个数中的最大者.请在( )添入正确内容.main( ){int x=4,y=6,z=7;int ( )if( )u=x;else u=y;if( )v=u;else v=z;printf(“v=%d”,v);}19.以下程序实现:输入三个整数,按从大到小的顺序进行输出.请在( )内填入正确内容main( ){int x,y,z,c;scanf(“%d%d%d”,&x,&y,&z);if( ){c=y;y=z;z=c;}if( ){c=x;x=z;z=c;}if( ){c=x;x=y;y=c;}printf(“%d,%d,%d”,x,y,z);}20.以下程序对输入的两个整数,按从大到小顺序输出.请在( )内填正确内容.main ( ){int x,y,z;scanf(“%d,%d,”,&x,&y);if( ){z=x; }printf(“%d,%d”,x,y);}21.以下程序对输入的一个小写字母,将字母循环后移5个位置后输出.如’a’变成’f’,’w’变成’b’.请在( )填入正确内容#include “stdio.h”main( ){char c;c= ;if(c>=’a’&&c<=’u’)else if(c>=’v’&&c<=’z’)putchar(c);}22.输入一个字符,如果它是一个大写字母,则把它变成小写,如果是小写,则变成大写,其他字符不变,请在( )填正确内容main ( ){char ch;scanf(“%c”,&ch);if( )ch=ch+32; else if(ch>=’a’&&ch<=’z’)(2) printf(“%c”,ch);}23.以下程序的运行结果是( ) main( ){int a,b,c;int s,w,t;s=w=t=0;a=-1,b=3,c=3;if(c>0)s=a+b;if(a<=0){if(b>0)if(c<=0)w=a-b;}else if(c>0)w=a-b;else t=c;printf(“%d%d%d”,s,w,t);}24.以下程序的运行结果是( ) main( ){int a,b,c,d,x;a=c=0;b=1;d=20;if(a)d=d-10;else if(! b)if(! c)x=15;else x=25;printf(“%d\n”,d);}25.以下程序的运行结果是( )#include<stdio.h>main( ){int x,y=1,z;if(y!=0)x=5;printf(“\t%d\n”,x);if(y= =0)x=4;else x=5;printf(“\t%d\n”,x);x=1;if(y<0)if(y>0)x=4;else x=5;printf(“\t%d\n”,x);}26.以下程序的运行结果是( ) #include<stdio.h>main( ){int x,y=-2,z=0;if((z=y)<0)x=4;else if(y= =0)x=5;else x=6;printf(“\t%d\t%d\n”,x,z); if(z=(y= =0))x=5;x=4;printf(“\t%d\t%d\n”,x,z); if(x=z=y)x=4;printf(“\t%d\t%d\n”,x,z);} 27.阅读下面程序:main ( ){int s,t,a,b;scanf(“%d,%d”,&a,&b);s=1;t=1;if(a>0)s=s+1;if(a>b)t=s+t;else if(a= =b)t=5;else t=2*s;printf(“s=%d,t=%d”,s,t);}为使输出结果t=4,输入量a和b应满足的条件是( )28.请阅读下面程序:main( ){int s ,t,a,b;scanf(“%d,%d”,&a,&b);s=1;t=1;if(a>0)s=s+1;if(a>b)t=s+t;else if(a= =b)t=5;else t=2*s;printf(“s=%d,t=%d”,s,t);}为使输出结果s=1,t=5,输入量a和b应满足条件是( )29.下面程序根据以下函数关系,对输入的每个x值,计算出y值,在( )填正确内容main( ){int x,y;scanf(“%d,&x);if(1)y=x*(x+2);else if(2)y=2*x;else if(x<=-1)y=x-1;else( 3 );if(y!=-1)printf(“%d”,y);else printf(“error”);}30.下面程序根据以下函数关系,对输入的每个x值,计算出相应的y值.在( ) 填正确内容#include “math.h”main( ){int x,a;float y;scanf(“%d%d”,&x,&a);if( )y=0;else if( )y=sqrt(a*a-x*x);else y=x;printf(“%f”,y);}31.以下程序的功能是计算一元二次方程ax2+bx+c=0的根,在( )填正确内容#include “math.h”main( ){float a,b,c,t,disc,twoa,term1,term2;printf(“enter a,b,c:”);scanf(“%f%f%f”,&a,&b,&c);if( )if( )printf(“no answer due to input error\n”);else printf(“the single root is%f\n”,-c/b);else{disc=b*b-4*a*c;twoa=2*a;terml=-b/twoa;t=abs(disc);term2=sqrt(t)/twoa;if(3)printf(“complex root\n real part=%fimag part=%f\n”, terml,term2);else printf(“real roots\n rootl=%froot2=%f\n”,terml+term2,term1-term2);}}32.以下程序根据输入的三角形的三边判断是否能组成三角形,若可以则输出它的面积和三角形的类型.在( )填正确内容.#include“math.h”main( ){float a,b,c;float s,area;scanf(“%f %f %f”,&a,&b,&c);if( ){s=(a+b+c)/2;area=sqrt(s*(s-a)*(s-b)*(s-c));printf(“%f”,area);if( )printf(“等边三角形”);else if( )printf(“等腰三角形”);else if((a*a+b*b= =c*c)| |(a*a+c*c= =b*b)| |(b*b+c*c= =a*a) )printf(“直角三角形”);else printf(“一般三角形”);}else printf(“不能组成三角形”);}33.某邮局对邮寄包裹有如下规定:若包裹的长宽高任一尺寸超过1米或重量超过30千克,不予邮寄;对可以邮寄的包裹每件收手续费0.2元,再加上根据下表按重量wei计算的资料:重量(千克) 收费标准(元/公斤)wei<=10 0.8010<wei<=20 0.7520<wei<=30 0.70请在程序的[ ]内填入正确的内容.main( ){float len,wei,hei,wid,mon,r;scanf(“%f %f %f %f”,&len,&wid,&hei,&wei);if(len>1| |wid>1| |hei>1| |wei>30);else if(wei<10) r=0.8;else if(wei<=20) r=0.75;else if(wei<=30);if(r= =-1)printf(“error\n”):else{ ;printf(“%f”,mon);}}34.以下程序的功能是判断输入的年份是否是闰年.请在[ ]内填入正确的内容.main( ){int y,f;scanf(“%d”,&y);if(y%400= =0) f=1;else if( ) f=1;else ;if(f)printf(“%d is”,y);else printf(“%d is not”,y);printf(“a leap year\n”);}35.有四个数a, b, c, d,要求按从大到小的顺序输出.请在[ ]内填入正确内容main( ){int a,b,c,d,t;scanf(“%d %d %d %d”,&a,&b,&c,&d);if(a<b){t=a;a=b;b=t;}if ( ){t=c;c=d;d=t;}if(a<c){t=a;a=c;c=t;}if( ){t=b;b=c;c=t;}if(b<d){t=b;b=d;d=t;}if(c<d){t=c;c=d;d=t;}printf(“%d %d %d %d\n”,a,b,c,d);}36.以下程序的运行结果是__main( ){int a=2,b=3,c;c=a;if(a>b)c=1;else if(a= =b)c=0;else c=-1;printf(“%d\n”,c);}37.在if后一对圆括号中表示a不等于0的关系,则能正确表示这一关系的表达式为_______。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
班级 学号 姓名
1
IF 语句练习题
一、选择题:
1.赋值语句x=x+1的正确含义是
(A) 变量x 与x+1的值相等 (B) 将变量x 的值加到x+1中去
(C) 将变量x 的值加1后赋值给变量x (D) 变量x 的值为1
2.VB 语句If i=1 Then j=1,下列说法正确的是 (A)i=1和j=1均为赋值语句 (B)i=1和j=1均为关系表达式
(C)i=1为关系表达式,j=1均为赋值语句 (D)i=1为赋值语句,j=1为关系表达式
二、填空题:
1.有如下VB 程序段:该程序段运行后,变量c 的值为____________。
a = "English" b = "f"
c = b + Mid(a, 5, 3)
2.有如下VB 程序段:该程序段运行后,在文本框Text1上显示的是____________。
t = 130 h = 170
b = (h - 100) * 2 If t > b Then
Text1.text="超标" ‘ 显示"超标" Else
Text1.text="正常" ‘ 显示"正常" End If
3.有如下VB 程序段:该程序段运行后,在文本框Text1上显示的是____________。
w = 9 a = 90 b = 50
If w > 10 Or a * b > 4000 Then Text1.text = "托运" Else
Text1.text = "携带" End If
4. 有如下VB 程序段:该程序段运行后,在文本框Text1上显示的是____________。
a = 10
b = 6
c = 5
If a + b > c And b + c > a And c + a > b Then Text1.text = "YES" Else
Text1.text = "NO" End If
5. 有如下VB 程序段:该程序段运行后,在文本框Text1上显示的是____________。
a = 1.45 : b = 1.67
If a < b Then min = a Else min = b Text1.text = str(min)
6. 有如下VB 程序段:该程序段运行后,在文本框Text1上显示的是____________。
x = 32
If x Mod 2 = 0 Then f = True Else f = False Text1.text = x
7. 有如下VB 程序段:该程序段运行后,在文本框Text1上显示的是____________。
m = 160
If m <= 100 Then
Text1.text = "不打折"
ElseIf m > 100 And m <= 150 Then Text1.text = "9.5折" Else
Text1.text = "9折" End If
8.有如下VB 程序段:该程序段运行后,在文本框Text1上显示的是____________。
m = 160
If m <= 100 Then
Text1.text = "不打折"
ElseIf m > 100 And m <= 150 Then Text1.text = "9.5折" Else
Text1.text = "9折" End If
班级 学号 姓名
2
三、补充程序段:
1.体质指数(BMI )是目前国际上常用的衡量人体胖瘦程度以及是否健康的一个标准。
其计算公式为:
体质指数(BMI)=体重(Kg)/(身高*身高(M)) 当指数18.5<BMI ≤25为健康
下列VB 程序是用来计算BMI 体质指数的,其中Texw 文本框用于输入体重,Texh 文本框用于输入身高,
Text3文本框用于输出结果,请将程序补充完整 Dim w as single ‘变量w 中存放体重 Dim h as single
‘变量h 中存放身高
‘变量bmi 中存放体质指数
w = Val(Txtw.Text) ‘输入体重 h = Val(Txth.Text) ‘输入身高 BMI =
If Then
Text3.Text = "健康"
Text3.Text = "不健康" End If
2.当体质指数B MI≤18.5为“消瘦”,BMI >25为“肥胖”,18.5<BMI ≤25为正常,如何修改程序 Dim w as single ‘变量w 中存放体重 Dim h as single ‘变量h 中存放身高
h = Val(Txth.Text) w = Val(Txtw.Text)。