题目内容

已知检查括号匹配及注释、字符串处理的C源程序如下: #include<stdio.h> int brace,brack,paren; void in_quote(int c); void in_comment(void); void search(int c); /*rudimentary syntax checKer for C program*/ int main() { int c; extern int brace,brack,paren; while((c=getchar())!=EOF){ if(c==’/’){ if((c=getchar())==’*’) in_comment(); /*inside comment*/ else search(C) ; }else if(c==’\"||c=="") in_quote(c); /*inside quote*/ else search(c); if(brace<0){ /*output errors*/ printf("Unbalanced braces\n"); brace=0; }else if(brack<0){ printf("Unbalanced brackets\n"); brack=0; }else if(paren<0){ printf("Unbalanced parentheses\n"); paren=0; } } if(brace>0) /*output errors*/ printf("Unbalanced braces\n"); if(brack>0) printf("Unbalanced brackets\n"); if(paren>0) printf("Unbalanced parentheses\n"); return 0; } /*search:search for rudimentary syntax errors*/ void search(int c) { extern int brace,brack,paren; if(c==’{’) ++brace; else if(c==’}’) --brace; else if(c==’[’) ++brack; else if(c==’]’) --brack; else if(c==’(’) ++paren; else if(c==’)’) --paren; } /*in_comment:inside of a valid comment*/ void in_comment(void) { int c,d; c=getchar(); d=getchar(); /*curr character*/ while(c!=’*’||d!=’/’){ /*search for end*/ c=d; d=getchar(); } } /*in_quote:inside quote*/ void in_quote(int c) { int d; while((d=getchar())! =c) /*search end quote*/ if(d==’\\’) getchar(); /*ignore escape seq*/ } 设计一组测试用例,使该程序所有函数的语句覆盖率和分支覆盖率均能达到100%。如果认为该程序的语句覆盖率或分支覆盖率无法达到100%,需说明为什么。

查看答案
更多问题

Do people stop once they have achieved something No! In life, we are always trying to do things better or having more of the same success.Jane Fonda moved from being an Academy Award actress to a successful businesswoman. Her aerobics (有氧体操) workout videos have been sold around the world.Athletes are constantly making greater and greater efforts to lower time for races; increase heights or distances.The world of medicine has had its series of successes too. Christian Barnard performed several successful heart transplants. Other medical experts have achieved organ transplants. Throughout the ages, mankind has found treatment and cures for tuberculosis (肺结核), cancer, and other diseases. A cure of AIDS might soon be discovered.Age does not seem to slow down achievers. Tina Turner at 54 is still singing with great energy and attracting sell-out crowds wherever she goes.At work, we go all out for achievements too. Success may mean organizing a conference more effectively and efficiently each year. Sometimes, it is not a pat on the back or the promotion that makes it worthwhile. Often it is the inner thrill and satisfaction of achievement, no matter how small it may be.Aiming for success doesn’t mean you are greedy or dissatisfied. It is all part of gaining new experiences and dimensions in life. It finally makes you a more interesting and useful person in society. The word "dimensions" in the last paragraph possibly means ()

A. directions
B. aspects
C. lessons
D. ambitions

Male advertisersFemale advertisers1MALE, aged 25, WLTM female, n/s, 20-30 for friendship, possible romance.I like pubs, clubs, staying in, aswell as going out. I live in theWindsor area and t get on well withkids.AFEMALE, 26, prof, fairlyslim, WLTM a slim male, 26-33, for friendship andpossible romance.2IF you are not separated oremotionally unstable but are a widowover 55 & looking for partner withview to long-term & meaningfulrelationship, then this 67 year oldwidower could be the one for you.BACTIVE lady, living inMaidstone area, early 60sWLTM females or males forfriendship and to shareinterests, mostly travel.3HL, I’m Andy, 32yo and divorced. Ahappy-go-lucky person looking for alady between 25 and 40. Single parentswelcome as I love children and a homelife.CARE you the romantic,friendly, articulate malewith varied interests and aGSOH that this woman islooking for If so and you’re40ish-50ish but feeling 30ishthen we will have a lot incommon.4MALE, 50s, caring, & sincere, with aGSOH, seeks an affectionate lady forfriendship, possible romance.DLADY, 40s, fairly slim, seeksa kind, generous, warm-hearted man, about same age,for friendship and outings.5I am an energetic man of 63, butdon’t look it. I have a good head ofhair. I like country find westernmusic and historical places, walking,a pint now and again. I’m stillworking part-time, but I don’t drive.I have a GSOH.EHELLO. my name is Liz. I am19 yrs old and live in theCambridge area. I am seekinga male 20-25. enjoy pubs andclubs and I like nights in orout and I like children. I AM5’5″ with red hair. What might be the name of this advertising section()

A. Help Wanted
B. Public Info
C. Family Ad
D. Meeting Place

甲与乙签订一份租赁合同,结果乙用假币履行合同义务,此案中因客体的违法而不存在合法的法律关系。()

A. 对
B. 错

尽管大家开始抵制珍稀动物的皮草产品,但仍有家居制造商将珍稀动物的皮毛用于家居饰品。几年前专家发明了一种新的高仿合成皮草,受到了家居制造商的广泛好评。但从最近几年的统计看,各地为获取皮毛而对珍稀动物进行捕杀的活动却并没有减少。以下选项中,最有助于对“捕杀活动没有减少”进行解释的是( )。

A. 生产新的高仿合成皮草比生产原来的合成皮草的成本更低
B. 新的高仿合成皮草与动物皮毛的质地相似,很难区分
C. 绝大部分珍稀动物的皮毛用在越来越流行的皮草服饰上
D. 家居制造商在销售大的家居物件时,往往将家居饰品当作赠品免费送给购买者

答案查题题库