第六章习题Complex-revised

合集下载

编译原理第六章到第十一章课后习题答案

编译原理第六章到第十一章课后习题答案

编译原理第六章到第十一章课后习题答案p116/1.已知文法G[S]为:S→a|∧|(T)T→T,S|S(1) 计算FIRSTVT -- LASTVT表(2) 构造算符优先关系表(OPERATER PRIORITY RELATION TABLE),说明是否为算符优先文法。

=: #=#, (=)<: (< FIRSTVT(T) , ,<firstvt(s)<="" ,="" p="">>:LASTVT(S)># , LASTVT(T)>), LASTVT(T)> ,表中无多重人口所以是算符优先(OPG)文法。

(3)计算G[S]的优先函数。

收敛(4)对输入串(a,a)#的算符优先分析过程为Success!3.有文法G(S):s->Vv->T/ViTT->F/T+FF->)V*|((1)(+(i(的规范推导S=>V=>ViT=>ViF=>Vi(=>Ti(=>T+Fi(=>T+(i(=>F+(i(=>(+(i((2)F+Fi(的短语、句柄、素短语。

短语S: F+Fi(T1:F+F (素短语)T2:F (句柄)F:( (素短语)(3) G(S)是否为OPG?若是,给出(1)中句子的分析过程!S’->#S# S->V V->T/ViT T->F/T+F F->)V*|(算符优先关系表(OPERATER PRIORITY RELATION TABLE)对输入串(+(I(的算符优先分析过程为:p152/2文法:S→L.L|LL→LB|BB→0|1拓广文法为G′,增加产生式S′→SI3若产生式排序为:0 S' →S1 S →L.L2 S →L3 L →LB4 L →B5 B →06 B →1由产生式知:First (S' ) = {0,1}First (S ) = {0,1}First (L ) = {0,1}First (B ) = {0,1}Follow(S' ) = {#}Follow(S ) = {#}Follow(L ) = {.,0,1,#}Follow(B ) = {.,0,1,#}G′的LR(0)项目集族及识别活前缀的DFA如下图所示:I5B →.0和B →.1为移进项目,S →L.为归约项目,存在移进-归约冲突,因此所给文法不是LR(0)文法。

编译原理第6章习题答案

编译原理第6章习题答案
1)抽象语法树 2)四元式序列 3)三元式序列 4)间接三元式序列
1)抽象语法树:
2)四元式序列:
3)三元式序列:
4)间接三元式序列:
6.4.1 向图6-19的翻译方案中加入对应于下列产生式的规则: 1) E E1 * E2 2) E E1 (单目加)
E.addr = E1.addr E.code = E1.code
例如:+3
6.4.2 使用图6-20中的增量式翻译方案重复练习6.4.1
{E.addr = E1.addr}
在增量方式中,gen不仅要构造出一个新的三地址指令,还 要将它添加到至今为止已生成的指令序列之后。
6.4.3 使用使用图6-22所示的翻译方案来翻译下 列赋值语句: 2) x = a[i][j] + b[i][j] 假设w1为数组a的第一维的宽度,w2为数组b 的第一维的宽度,整数宽度为w。第6章习题答案
作业: 6.1.1 6.2.1 6.4.1 6.4.2 6.4.3 6.6.1
6.7.1 (1) 补充习题1
第6章 中间代码生成
6.1.1 为下面的表达式构造DAG ((x+y)-((x+y)*(x-y)))+((x+y)*(x-y))
6.2.1 将算术表达式 a+-(b+c) 翻译成
补充习题1:用本节所给的翻译模式(采用回填)翻译语句: if (a<b || c<d && e<f ) A1 else A2; while (a<b) A3 ; 假定语句序号从100起算,又假定A1、A2、A3语句各生成10条指令。
100 if a<b goto 106 101 goto 102 102 if c<d goto 104 103 goto 117 104 if e<f goto 106 105 goto 117 106 107 . A1 . 115 116 goto 127 117 118 A2 . . 126 127 if a<b goto 129 128 goto 140 129 130 A3 . . 138 139 goto 127 140 141 142 143 144 145

XX医学院本科各专业《Python》第六章习题与答案-2020年精品

XX医学院本科各专业《Python》第六章习题与答案-2020年精品

XX医学院本科各专业《Python》第六章习题与答案一、选择题*1. (1,2,3)*3的执行结果是哪个?AA.(1,2,3,1,2,3,1,2,3)B.(1,2,3)(1,2,3)(1,2,3)C.(3,6,9)D. 出错*2.S和T是两个集合,哪个选项对S^T的描述是正确的?DA. S和T的并运算,包括在集合S和T的所有元素B. S和T的差运算,包括在集合S但不在T中的元素C. S和T的交运算,包括同时在集合S和T中的元素D. S和T的补运算,包括集合S和T中的非相同元素*3. S和T是两个集合,哪个选项对S-T的描述是正确的?BA. S和T的并运算,包括在集合S和T的所有元素B. S和T的差运算,包括在集合S但不在T中的元素C. S和T的交运算,包括同时在集合S和T中的元素D. S和T的补运算,包括集合S和T中的非相同元素*4. S是一个集合,哪个选项关于S.pop( )的说法是错误的?BA. 默认情况下,随机取回集合S中的一个元素B. 当给定参数时,S.pop(i)取回集合S中序号为i的元素C. 调用S.pop( )之后,取回的元素将在S中删除D. 如果S为空,调用S.pop( )之后产生KeyError异常*5. 对于序列s,哪个选项能够返回序列s中第i到j以k为步长的元素子序列?CA. s[i,j,k]B. s[i;j;k]C. s[i:j:k]D. s(i,j,k)*6. 序列s,哪个选项对s.index(x)的描述是正确的?CA. 返回序列s中序号为x的元素B.返回序列s中元素x所有出现位置的序号C.返回序列s中元素x第一次出现的序号D.返回序列s中x的长度*7. 元组变量t=(“cat”,”dog”,”tiger”,”human”),哪个选项是t[::-1]的结果?AA. (‘human’,’tiger’,’dog’,’cat’)B. [‘human’,’tiger’,’dog’,’cat’]C.{ ‘human’,’tiger’,’dog’,’cat’}D. 运行出错*8. 列表ls,哪个选项对ls.append(x)的描述是正确的?BA. 向ls中增加元素,如果x是一个列表,则可以同时增加多个元素B. 只能向列表ls最后增加一个元素xC. 向列表ls最前面增加一个元素xD. 替换列表ls最后一个元素为x*9. 列表ls,哪个选项对ls.reverse( )的描述是正确的?BA. 将ls中元素逆序,返回一个新列表B. 将ls中元素逆序,更新列表lsC. 将ls中可以比较的元素进行逆序处理D. 如果ls为空,则产生一个异常*10. 哪个选项能够向列表ls中增加五个元素?CA. ls.append([1,2,3,4,5])B.ls.append(1,2,3,4,5)C.ls+=1,2,3,4,5D. ls.insert(1,2,3,4,5)*11. 那个选项不能生成一个空字典?DA.{}B.dict( )C.dict([ ])D. {[ ]}*12. 给定字典d,哪个选项对d.keys( )的描述是正确的?AA. 返回一种dict_keys类型,包括字典d中所有键B. 返回一个列表类型,包括字典d中所有键C.返回一个元组类型,包括字典d中所有键D. 返回一个集合类型,包括字典d中所有键*13. 给定字典d,哪个选项对d.values( )的描述是正确的?AA. 返回一种dict_values类型,包括字典d中所有值B. 返回一个列表类型,包括字典d中所有值C. 返回一个元组类型,包括字典d中所有值D. 返回一个集合类型,包括字典d中所有值*14. 给定字典d,哪个选项对d.items( )的描述是正确的?AA. 返回一种dict_items类型,包括字典d中所有键值对B. 返回一个列表类型,每个元素是一个二元元组,包括字典d中所有键值对C. 返回一个元组类型,每个元素是一个二元元组,包括字典d中所有键值对D. 返回一个集合类型,每个元素是一个二元元组,包括字典d中所有键值对*15. 给定字典d,哪个选项对d.get(x,y )的描述是正确的?BA. 返回字典d中键值对为x:y的值B. 返回字典d中键值为x的值,如果不存在,则返回yC. 返回字典d中键值为x的值,如果不存在,则返回空D. 返回字典d中键值为y的值,如果不存在,则返回x*16. 给定字典d,哪个选项对x in d的描述是正确的?BA. x是一个二元元组,判断x是否是字典d中的键值对B. 判断x是否是字典d中的键C. 判断x是否是字典d中的值D. 判断x是否是在字典d中以键或值方式存在*17.给定字典d,哪个选项可以清空该字典并保留变量?CA.d.remove( )B.d.pop( )C.d.clear( )D. del d*18.以下不能创建一个字典的语句是:AA. dict1={[1,2,3]:”aksd”}B. dict1={}C.dict1={(1,2,3):”aksd”}D. dict1={3:5} *19.哪个选项是下面代码的输出结果?Cd={‘a’:1,’b’:2,’b’:’3’}print(d[‘b’])A. 1B. 2C. 3D. {‘b’:2}*20. 关于大括号{},以下描述正确的是:CA. 直接使用{}将生成一个集合类型B. 直接使用{}将生成一个列表类型C. 直接使用{}将生成一个字典类型D. 直接使用{}将生成一个元组类型21.表达式[1, 2, 3,4]*3的执行结果为(A)。

编译原理第6章习题与答案

编译原理第6章习题与答案

第6章习题6-1 将下列中缀式改写为逆波兰式。

(1) -A*(B+C)/(D-E)(2) ((a*d+c)/d+e)*f+g(3) a+x≤4∨(c>d*3)(4) a∨b∧c<d*e/f6-2 将下列逆波兰式改写为中缀式。

(1) abc*+(2) abc-*cd+e/-(3) abc+≤a0>∧ab+0≠a0<∧∨6-3 将下列语句翻译成四元式序列。

(1) X:=A*(B+C)+D(2) if A∧(B∨(C∨D)) then S1 else S2(3) while A<C∧B>0 doif A=1 then C:=C+1 else A:=A+26-4 设有二维PASCAL数组A[1··10,1··20]和三维PASCAL数组B[1··10, 1··20,1··30],给出赋值语句A[I,J]:=B[J,I+J,I+1]+X的四元式序列。

第5章习题答案6-1 解:(1) A-BC+*DE-/(2) ad*c+d/e+f*g+(3) ax+4≤cd3*>∨(4) abcde*f/<∧∨6-2 解:(1) a+b*c(2) a*(b-c)-(c+d)/e(3) a≤b+c∧a>0∨a+b≠0∧a<06-3 解:(1) (1) (+,B,C,T1)(2) (*,A,T1 ,T2)(3) (+,T2 ,D,T3)(4) (=,T3 ,0,X)(2) 如下所示:(1) (jnz,A,0,3);(2) (j,0,0,p+1);(3) (jnz,B,0,9);(4) (j,0,0,5);(5) (jnz,C,0,9);(6) (j,0,0,7);(7) (jnz,D,0,9);(8) (j,0,0,p+1);(9) 与S1相应的四元式序列(p) (j,0,0,q)(p+1) 与S2相应的四元式序列(q) …(3) 假设所产生的四元式序列编号从1开始(1) (j<A,C,3)(2) (j,0,0,13)(3) (j>,B,0,5)(4) (j,0,0,13)(5) (j=,A,1,7)(6) (j,0,0,10)(7) (+,C,1,T1)(8) (=,T1 , ,C)(9) (j,0,0,1)(10) (+,A,2,T2)(11) (=,T2 , ,A)(12) (j,0,0,1)(13) …6-4 解:(1) (*,I,20,T1)(2) (+,J,T1,T1)(3) (-,a A,C A ,T2)(4) (+,I,J,T3)(5) (*,J,20,T4)(6) (+,T3 ,T4 ,T4)(7) (+,I,1,T5)(8) (*,T4,30,T6)(9) (+,T5 ,T6 ,T6)(10) (-,a B,C B ,T7)(11) (=[],T7[T6],0,T8)(12) (+,T8 ,X,T9)(13) ([]=,T9 ,0,T2[T1])(注:(1)~(3)是计算下标变量A[I,J]XXX的四元式,T2中存放的是CONSTPART部分,而T1中存放的是VARPART部分,a A表示数组A的首XXX;(4)~(10) 是计算下标变量B[J,I+J,I+1]XXX的四元式,T7中存放的是CONSTPART 部分,而T6中存放的是VARPART部分,a B表示数组B的首XXX。

编译原理第六章答案

编译原理第六章答案

第6章自底向上优先分析第1题已知文法G[S]为:S T a|A |(T)T,S|S(1)计算 G[S]的 FIRSTVT 和 LASTVT。

(2)构造G[S]的算符优先关系表并说明 G[S]是否为算符优先文法。

⑶计算G[S]的优先函数。

(4)给出输入串(a,a)#和(a,(a,a))#的算符优先分析过程。

答案:文法展开为:S^aS T AS T (T)T T T,ST T S(1) FIRSTVT - LASTVT 表::3)算符优先災系&友情提示:记得增加拓广文法S' T#S#,所以# FIRSTVT(S) , LASTVT(S) # 。

(4)対输入串(a+a> #的算符忧先分折过程为R (STACK) 当前输入字?j (CHAR)剁余输入申< PMPUT_STRING)胡作(ACTION)( a.a)#Move in武 a ,a)#XI OVE in…a)#Kx山忙匕:S-*a申a3)^- …Move in調)#Move in#(N-a)#RcdiKe: 5一n #(N,N)Rirdiive: T—^T.S)#Move inkfN) 耳Reduces S +(T| Success!对输入串(a,(a,a) ) #的算符优先分析过程为:第2题已知文法G[S]为:S T a|A |(T)T,S|S(1)给出(a,(a,a))和(a,a)的最右推导,和规范归约过程。

⑵ 将⑴和题1中的⑷进行比较给出算符优先归约和规范归约的区另叽答案:(I ) (a,a)的最右推导过程为: sn(T)(T.S)(T.a)=>(S.a)=>(a.a)(a.(a.a))的最右推导过程为: S=>(T)=>(T.S)=>(T.(T))=>(T.(T.a))=>(T.(S.a))=HT,(a.a))n(sg))^•(a.(a.a))(a.(a^a))的规范归约过程:(X册现范卩I约过用:(2)非终结符无关,只需知道把当前可归约串归约为某一个非终结符,不必知道该非终结符的名字是什么,因此去掉了单非终结符的归约。

硕士英语综合教程——第六章——原文(可编辑修改word版)

硕士英语综合教程——第六章——原文(可编辑修改word版)

How the City Hurts Your Brain, and What You Can Do about It1、The city has always been an engine of intellectual life, from the 18th-century coffeehouses of London, where citizens gathered to discuss chemistry and radical politics, to the Left Bank bars of modern Paris, where Pablo Picasso held forth on modern art. Without the metropolis, we might not have had the great art of Shakespeare or James Joyce; even Einstein was inspired by commuter trains.2、And yet, city life isn’t easy. The same London cafes that stimulated Ben Franklin also helped spread cholera; Picasso eventually bought an estate in quiet Provence. While the modern city might be a haven for playwrights, poets, and physicists, it’s also a deeply unnatural and overwhelming place.3、Now scientists have begun to examine how the city affects the brain, and the results are chastening. Just being in an urban environment, they have found, impairs our basic mental processes. After spending a few minutes on a crowded city street, the brain is less able to hold things in memory, and suffers from reduced self-control. While it’s long been recognized that city life is exhausting – that’s why Picasso left Paris – this new research suggests that cities actually dull our thinking, sometimes dramatically so.4、“The mind is a limited machine,”says Marc Berman, a psychologist at the University of Michigan and lead author of a new studythat measured the cognitive deficits caused by a short urban walk. “And we’re beginning to understand the different ways that a city can exceed those limitations.”5、One of the main forces at work is a stark lack of nature, which is surprisingly beneficial for the brain. Studies have demonstrated, for instance, that hospital patients recover more quickly when they can see trees from their windows, and that women living in public housing are better able to focus when their apartment overlooks a grassy courtyard. Even these fleeting glimpses of nature improve brain performance, it seems, because they provide a mental break from the urban roil.6、This research arrives just as humans cross an important milestone: For the first time in history, the majority of people reside in cities. For a species that evolved to live in small, primate tribes on the African savannah, such a migration marks a dramatic shift. Instead of inhabiting wide-open spaces, we’re crowded into concrete jungles, surrounded by taxis, traffic, and millions of strangers. In recent years, it’s become clear that such unnatural surroundings have important implications for our mental and physical health, and can powerfully alter how we think.7、Consider everything your brain has to keep track of as you walk down busy thoroughfare like Newbury Street. There are the crowed sidewalks full of distracted pedestrians who have to be avoided; the hazardous crosswalks that require the brain to monitor the flow of traffic.(The brain is a wary machine, always looking out for potential threats.) There’s the confusing urban grid, which forces people to think continually about where they’re going and how to get there. The reason such seemingly trivial mental tasks leave us depleted is that they exploit one of the crucial weak spots of the brain. A city is so overstuffed with stimuli that we need to constantly redirect our attention so that we aren’t distracted by irrelevant things, like a flashing neon sign or the cellphone conversation of a nearby passenger on the bus. This sort of controlled perception - we are telling the mind what to pay attention to –takes energy and effort. The mind is like a powerful supercomputer, but the act of paying attention consumes much of its processing power.8、Natural settings, in contrast, don’t require the same amount of cognitive effort. This idea is known as attention restoration theory, or ART, and it was first developed by Stephen Kaplan, a psychologist at the University of Michigan. While it’s long been known that human attention is a scarce resource – focusing in the morning makes it harder to focus in the afternoon – Kaplan hypothesized that immersion in nature might have a restorative effect. Imagine a walk around Walden Pond, in Concord. The woods surrounding the pond are filled with pitch pine and hickory trees. Chickadees and red-tailed hawks nest in the branches; squirrels and rabbits skirmish in the berry bushes. Natural settings are full of objects that automatically capture our attention, yet without triggering a negativeemotional response – unlike, say, a backfiring car. The mental machinery that directs attention can relax deeply, replenishing itself. “It’s not an accident that Central Park is in the middle of Manhattan,” says Berman. “They needed to put a park there.”9、In a study published last month, Berman outfitted undergraduates at the University of Michigan with GPS receivers. Some of the students tool a stroll in an arboretum, while others walked around the busy streets of downtown Ann Arbor. The subjects were then run through a battery of psychological tests. People who had walked through the city were in a worse mood and scored significantly lower on a test of attention and working memory, which involved repeating a series of numbers backwards. In fact, just glancing at a photograph of urban scenes led to measurable impairments, at least when compared with pictures of nature. “We see the picture of the busy street, and we automatically imagine what it’s like to be there,” says Berman. “And that’s when your ability to pay attention starts to suffer.” (Yuko Shimizu for the Boston Globe) This also helps explain why, according to several studies, children with attention –deficit disorder have fewer symptoms in natural settings. When surrounded by trees and animals, they are less likely to have behavioral problems and are better able to focus on a particular task.10、Studies have found that even a relatively paltry patch of nature can confer benefits. In the late 1990s, Frances Kuo, director of theLandscape and Human Health Laboratory at the University of Illinois, began interviewing female residents in the Robert Taylor Homes, a massive housing project on the South Side of Chicago. Kuo and her colleagues compared women randomly assigned to various apartment. Some had a view of nothing but concrete sprawl, the blacktop of parking lots and basketball courts. Others looked out on grassy courtyards filled with trees and flowerbeds. Kuo then measured the two groups on a variety of life challenges. She found that living in an apartment with a view of greenery led to significant improvements in every category. “We’re constructed a world that’s always drawing down from the same mental account,”Kuo says. “And then we’re surprised when (after spending time in the city) we can’t focus at home.”11、But the density of city life doesn’t just make it harder to focus: It also interferes with our self-control. In tat stroll down Newbury, the brain is also assaulted with temptations –caramel lattes, ipods, discounted cashmere sweaters, and high-heeled shoes. Resisting these temptations requires us to flex the prefrontal cortex, a nub of the brain just behind the eyes. Unfortunately, this is the same brain area that’s responsible for directed attention, which means that it’s already been depleted from walking around the city. As a result, it’s less able to exert self-control, which means we’re more likely to splurge computational powers, it’s surprisingly easy to short-circuit: all it takes is a hectic city street. “I thinkcities reveal how fragile some of our ‘higher’mental functions actually are,” Kuo says. “We take these talents for granted, but they really need to protected.”12、Related research has demonstrated that increased “cognitive load”– like the mental demands of being in a city – makes people more likely to choose chocolate cake instead of fruit salad, or indulge in an unhealthy snack. This is the one-two punch of city life: It subverts our ability to resist temptation even as it surrounds us with it, from fast-food outlets to fancy clothing stores. The end result is too many calories and too much credit card debt.13、City life can also lead to loss of emotional control. Kuo and her colleagues found less domestic violence in the apartments with views of greenery. These data build on earlier work that demonstrated how aspect of the urban environment, such as crowding and unpredictable noise, can also lead to increased levels of aggression. A tired brain, run down by the stimuli of city life, is more likely to lose its temper.14、Long before scientists warned about depleted prefrontal cortices, philosophers and landscape architects were warning about the effects of the undiluted city, and looking for ways to integrate nature into modern life. Ralph Waldo Emerson advised people to “adopt the pace of nature,”while the landscape architect Frederick Law Olmsted sought to create vibrant urban parks, such as Central Park in New York and the EmeraldNecklace in Boston, that allowed the masses to escape the maelstrom of urban life.15、Although Olmsted took pains to design parks with a variety of habitats and botanical settings, most urban green spaces are much less diverse. This is due in part to the “savannah hypothesis,”which argues that people prefer wide-open landscapes that resemble the African landscape in which we evolved. Over time, this hypothesis has led to a proliferation of expansive civic lawns, punctuated by a few trees and playing fields.16、However, these savannah-like parks are actually the least beneficial for the brain. In a recent paper, Richard Fuller, an ecologist at the University of Queensland, demonstrated that the psychological benefits of green space are closely linked to the diversity of its plant life. When a city park has a larger variety of trees, subjects that spend time in the park score higher on various measures of psychological well-being, at least when compared with less biodiverse parks. “We worry a lot about the effects of urbanization on other species,” Fuller says. “But we’re also affected by it. That’s why it’s so important to invest in the spaces that provide us with some relief.”17、When a park is properly designed, it can improve the function of the brain within minutes. As the Berman study demonstrates, just looking at a natural scene can lead to higher scores on tests of attention andmemory. While people themselves with Red Bull to redesigning the layout of offices, it appears that few of these treatments are as effective as simply taking a walk in a natural place.18、Given the myriad of mental problems that are exacerbated by city life, from an inability to pay attention to a lack of self-control, the question remains: Why do cities continue to grow? And why, even in the electronic age, do they endure as wellsprings of intellectual life?19、Recent research by scientists at the Santa Fe Institute used a set of complex mathematical algorithms to demonstrate that the very same urban features that trigger lapses in attention and memory – the crowded streets, the crushing density of people – also correlate with measures of innovation, as strangers interact with one another in unpredictable ways. It is the “concentration of social interactions” that is largely responsible for urban creativity, according to the scientists. The density of 18th-century London may have triggered outbreaks of disease, but it also led to intellectual breakthroughs, just as the density of Cambridge – one of the densest cities in America – contributes to its success as a creative center. One corollary of this research is that less dense urban areas, like Phoenix, may, over time, generate less innovation.20、The key, then ,is to find ways to mitigate the psychological damage of the metropolis while still preserving its unique benefits. Kuo, for instance, describes herself as “not a nature person,” but has learned toseek out more natural settings: The woods have become a kind of medicine. As a result, she’s better able to cope with the stresses of city life, while still enjoying its many pleasures and benefits. Because there always comes a time, as Lou Reed once sang, when a person wants to say: “I’m sick of the trees/take me to the city.”。

编译原理教程课后习题答案——第六章

编译原理教程课后习题答案——第六章

第六章运行时存储空间组织6.1 完成下列选择题:(1) 过程的DISPLAY表中记录了。

a. 过程的连接数据b. 过程的嵌套层次c. 过程的返回地址d. 过程的入口地址(2) 过程P1调用P2时,连接数据不包含。

a. 嵌套层次显示表b. 老SPc. 返回地址d. 全局DISPLAY地址(3) 堆式动态分配申请和释放存储空间遵守原则。

a. 先请先放b. 先请后放c. 后请先放d. 任意(4) 栈式动态分配与管理在过程返回时应做的工作有。

a. 保护SPb. 恢复SPc. 保护TOPd. 恢复TOP(5) 如果活动记录中没有DISPLAY表,则说明。

a. 程序中不允许有递归定义的过程b. 程序中不允许有嵌套定义的过程c. 程序中既不允许有嵌套定义的过程,也不允许有递归定义的过程d. 程序中允许有递归定义的过程,也允许有嵌套定义的过程【解答】(1) b (2) a(3) d (4) b (5) b6.2 何谓嵌套过程语言运行时的DISPLAY表?它的作用是什么?【解答】当过程定义允许嵌套时,一个过程在运行中应能够引用在静态定义时包围它的任一外层过程所定义的变量或数组。

也就是说,在栈式动态存储分配方式下的运行中,一个过程Q可能引用它的任一外层过程P的最新活动记录中的某些数据。

因此,过程Q运行时必须知道它的所有(静态)外层过程的最新活动记录的地址。

由于允许递归和可变数组,这些外层过程的活动记录的位置也往往是变迁的。

因此,必须设法跟踪每个(静态)外层的最新活动记录的位置,而完成这一功能的就是DISPLAY嵌套层次显示表。

也即,每当进入一个过程后,在建立它的活动记录区的同时也建立一张DISPLAY表,它自顶而下每个单元依次存放着现行层、直接外层等,直至最外层(主程序层)等每一层过程的最新活动记录的起始地址。

6.3 (1) 写出实现一般递归过程的活动记录结构以及过程调用、过程进入与过程返回的指令;(2) 对以return(表达式)形式(这个表达式本身是一个递归调用)返回函数值的特殊函数过程,给出不增加时间开销但能节省存储空间的实现方法。

coa练习题答案第六章作业及参考答案

coa练习题答案第六章作业及参考答案

第六章作业一、选择题1. RAID levels_________make use of an independent access technique.A. 2B. 3C. 4D. all2. In RAID 4, to calculate the new parity, involves _________reads.A. oneB. twoC. threeD.four3. During a read/write operation, the head is ___________A. movingB. stationaryC. rotatingD. above all4. On a movable head system, the time it takes to position the head at the track is know as______.A. seek timeB. rotational delayC. access timeD. transfer time5. RAID makes use of stored______information that enable the recovery of data lost due to a disk failure.A. parityB. user dataC. OSD. anyone6. Recording and retrieval via _________called a headA. conductive coilB. aluminiumC. glassD. Magnetic field7.In Winchester disk track format, _________is a unique identifier or address used to locate a particular sector.A. SYNCHB. GapC. ID fieldD. Data field8. Data are transferred to and from the disk in ________.A. trackB. sectorC. gapD. cylinder9. In _________, each logical strip is mapped to two separate physical disk.A. RAID 1B. RAID 2C. RAID 3D. RAID 410. With _________, the bits of an error correcting code are stored in the corresponding bit position on multiple parity disk.A. RAID 1B. RAID 2C. RAID 3D. RAID 411. The write-once read-many CD, known as ________.A. CD-ROMB. CD-RC. CD-R/WD. DVD二、How are data written onto a magnetic disk?(Head or side/Track/Sector)三、In the context of RAID, what is the distinction between parallel access and independent access? 参考Page181 & Page182四、P193 6.3。

Chapter 6 参考答案

Chapter 6 参考答案

第六章练习题(参考答案)I. Define the following terms (名词解释) :标准答案:略II. Multiple Choice Questions (单项选择):III. Fill in the Blanks Questions (填空题)IV. True/False Questions (判断题)标准答案:1-5: FTTTF 6-10: TFTTF 11-15: TFTTTV. Essay Questions (问答题)1.参考答案:A sovereign state is independent and free from all external control;enjoys full legal equality with other states; governs it own territory; selects its own political, economic, and social systems; and has the power to enter into agreements with other nations.2.参考答案:Nationalism can best be described as an intense feeling of nationalpride and unity, an awakening of a nation's people to pride in their country. This pride can take an anti-foreign business bias, and minor harassment and controls of foreign investment are supported, if not applauded.3.参考答案:Confiscation is the seizing of a company's assets without payment.Expropriation occurs where the government seizes and investment but some reimbursement of assets is made. Domestication occurs when host countries gradually cause the transfer of foreign investments to national control and ownership through a series of government decrees by mandating local ownership and greater national involvement in a company's management.4.参考答案:The text lists six economic risks--exchange controls, local-content laws,import restrictions, tax controls, price controls, and labor problems.5.参考答案:According to information presented in the text, Mr. Branch shouldmake sure that his investment provides at least one of the following benefits to the Chilean government and/or the people of Chile--benefits should (1) improve the balance of payments by increasing exports or reducing imports through import substitution; (2) use locally produced resources; (3) transfer capital, technolo gy, or skills; (4) create jobs; or (5) make tax contributions.。

统计学习[The Elements of Statistical Learning]第六章习题

统计学习[The Elements of Statistical Learning]第六章习题
i=1
0
li (x0 ) = 1
When j ∈ {1, 2, . . . , k }, we have vector-valued function b(x)T = (1, x, x2 , . . . , xk ) and B = [1, x, x2 , . . . , xk ]. From (1), we similarly have
li (x0 )xa i (−1)b xj 0 // (2)
= bj (x0 ) =
i=1 b b a (−1) x0 x0 = N
(xi − x0 )j li (x0 )
i=1 N 2j
=
i=1 n=1
(−1)bn xj 0 li (x0 ) = 0
1
Hence we have the bias
The Element of Statistical Learning – Chapter 6
oxstar@SJTU January 6, 2011
Ex. 6.2 Show that i=1 (xi − x0 )li (x0 ) = 0 for local linear regression. Define bj (x0 ) = i=1 (xi − x0 )j li (x0 ). Show that b0 (x0 ) = 1 for local polynomial regression of any degree (including local constants). Show that bj (x0 ) = 0 for all j ∈ {1, 2, . . . , k } for local polynomial regression of degree k . What are the implications of this on the bias? Proof By the definition of vector-valued function, b(x)T = (1, x) and B = [1, x], so we have b(x0 )T = b(x0 )T (BT W(x0 )B)−1 BT W(x0 )B (1, x0 ) = b(x0 )T (BT W(x0 )B)−1 BT W(x0 )[1, x0 ] 1 b(x0 )T (BT W(x0 )B)−1 BT W(x0 )1 = = x0 b(x0 )T (BT W(x0 )B)−1 BT W(x0 )x0 =

C++程序设计Y.Daniel Liang 第六章课后习题答案

C++程序设计Y.Daniel Liang 第六章课后习题答案

Exercise6_2#include <iostream>using namespace std;int main(){// Prompt the user to enter the first numbercout << "Enter an integer: ";int max;cin >> max;int count = 1;// Prompt the user to enter the remaining five numbers for (int i = 1; i <= 5; i++) {cout << "Enter an integer: ";int temp;cin >> temp;if (temp > max) {max = temp;count = 1;}else if (temp == max)count++;}cout << "\n" <<"max is " << max << "\n" <<"the occurrence count is " << count;return 0;}Exercise6_4#include <iostream>using namespace std;int main(){double scores[100];double sum = 0;int count = 0;do{cout << "Enter a new score: ";cin >> scores[count];sum += scores[count];}while (scores[count++] >= 0);double average = (sum - scores[count]) / (count - 1);int numOfAbove = 0;int numOfBelow = 0;for (int i = 0; i < count - 1; i++)if (scores[i] >= average)numOfAbove++;elsenumOfBelow++;cout << "Average is " << average << endl;cout << "Number of scores above or equal to the average " << numOfAbove << endl; cout << "Number of scores below the average " << numOfBelow << endl;return 0;}Exercise6_6#include <iostream>#include <cmath>using namespace std;int main(){const int NUM_OF_PRIMES = 50;// Store prime numbersint primeNumbers[NUM_OF_PRIMES];int count = 0; // Count the number of prime numbersint number = 2; // A number to be tested for primenessbool isPrime = true; // Is the current number prime?cout << "The first 50 prime numbers are \n";// Repeatedly find prime numberswhile (count < NUM_OF_PRIMES){// Assume the number is primeisPrime = true;// Test if number is primefor (int i = 0; i < count && primeNumbers[i] <= sqrt(1.0 * number); i++) {//If true, the number is not primeif (number % primeNumbers[i] == 0){// Set isPrime to false, if the number is not primeisPrime = false;break; // Exit the for loop}}// Print the prime number and increase the countif (isPrime){primeNumbers[count] = number;count++; // Increase the countif (count % 10 == 0){// Print the number and advance to the new linecout << number << endl;}elsecout << number << "\t";}// Check if the next number is primenumber++;}return 0;}Exercise6_8#include <iostream>#include <cmath>using namespace std;int average(int array[], int size) {int sum = 0;for (int i = 0; i < size; i++)sum += array[i];return sum / size;}double average(double array[], int size) { double sum = 0;for (int i = 0; i < size; i++)sum += array[i];return sum / size;}int main(){int list1[] = {1, 2, 3, 4, 5, 6};double list2[] = {5.0, 4.4, 1.9, 2.9, 3.4, 3.5};cout << average(list1, 6) << endl;cout << average(list2, 6) << endl;return 0;}Exercise6_10#include <iostream>#include <cmath>using namespace std;int minIndex(int list[], int size){int min = list[0];int minIndex = 0;for (int i = 1; i < size; i++)if (min > list[i]){min = list[i];minIndex = i;}return minIndex;}int main(){int list[] ={1, 2, 4, 5, 10, 100, 2, -22};cout << "The index of the min is " << minIndex(list, 8) << endl;return 0;}Exercise6_12#include <iostream>using namespace std;void reverse(int list[], int size){for (int i = 0, j = size - 1; i < size / 2; i++, j--){int temp = list[i];list[i] = list[j];list[j] = temp;}}int main(){int myList[] ={1, 2, 3, 4, 5, 6, 7, 8};reverse(myList, 8);for (int i = 0; i < 8; i++)cout << myList[i] << " ";return 0;}Exercise6_14#include <iostream>#include "LinearSearch.h"#include "BinarySearch.h"#include "SelectionSort.h"using namespace std;int main(){int list[100000];for (int i = 0; i < 100000; i++){list[i] = rand();}int key = rand();long startTime = time(0);cout << linearSearch(list, key, 100000) << endl;long endTime = time(0);cout << "End time: " << endTime << endl;cout << "Start time: " << startTime << endl;long executionTime = endTime - startTime;cout << "Execution time for linear search is " << executionTime << endl; selectionSort(list, 100000);startTime = time(0);cout << binarySearch(list, key, 100000) << endl;endTime = time(0);executionTime = endTime - startTime;cout << "Execution time for binary search is " << executionTime << endl;return 0;}Exercise6_16#include <iostream>#include "LinearSearch.h"#include "BinarySearch.h"#include "SelectionSort.h"using namespace std;/** The method for printing numbers */void printList(double list[], int size){for (int i = 0; i < size; i++)cout << list[i] << " ";cout << endl;}void bubbleSort(double list[], int size) {bool changed = true;do{changed = false;for (int j = 0; j < size - 1; j++)if (list[j] > list[j + 1]){//swap list[j] wiht list[j+1]double temp = list[j];list[j] = list[j + 1];list[j + 1] = temp;changed = true;}}while (changed);}int main(){// Initialize the listdouble myList[] ={5.0, 4.4, 1.9, 2.9, 3.4, 3.5};// Print the original listcout << "My list before sort is: "; printList(myList, 6);// Sort the listbubbleSort(myList, 6);// Print the sorted listcout << "\nMy list after sort is: " << endl; printList(myList, 6);return 0;}Exercise6_18#include <iostream>using namespace std;int main(){int m[4] [4] ={{1, 2, 4, 5},{6, 7, 8, 9},{10, 11, 12, 13},{14, 15, 16, 17}};int sum = 0;for (int i = 0; i < 4; i++)sum += m[i] [i];cout << "Sum of diagonal is " << sum << endl;return 0;}Exercise6_20#include <iostream>using namespace std;/** The method for sorting the numbers */void sortAndKeepIndex(int list[], int indexList[], int size) { int currentMax;int currentMaxIndex;// Initialize indexListfor (int i = 0; i < size; i++)indexList[i] = i;for (int i = size - 1; i >= 1; i--) {// Find the maximum in the list[0..i]currentMax = list[i];currentMaxIndex = i;for (int j = i - 1; j >= 0; j--) {if (currentMax < list[j]) {currentMax = list[j];currentMaxIndex = j;}}// Swap list[i] with list[currentMaxIndex] if necessary;if (currentMaxIndex != i) {list[currentMaxIndex] = list[i];list[i] = currentMax;// Swap the index in indexList tooint temp = indexList[i];indexList[i] = indexList[currentMaxIndex];indexList[currentMaxIndex] = temp;}}}int main(){const int NUMBER_OF_WORKERS = 8;double workHours[NUMBER_OF_WORKERS][7] = {{2, 4, 3, 4, 5, 8, 8},{7, 3, 4, 3, 3, 4, 4},{3, 3, 4, 3, 3, 2, 2},{9, 3, 4, 7, 3, 4, 1},{3, 5, 4, 3, 6, 3, 8},{3, 4, 4, 6, 3, 4, 4},{3, 7, 4, 8, 3, 8, 4},{6, 3, 5, 9, 2, 7, 9}};// Create an array to store total weekly hoursint weeklyHours[NUMBER_OF_WORKERS] = {0, 0, 0, 0, 0, 0, 0, 0};for (int i = 0; i < NUMBER_OF_WORKERS; i++)for (int j = 0; j < 7; j++)weeklyHours[i] += workHours[i][j];int indexList[NUMBER_OF_WORKERS];// Sort weeklyHourssortAndKeepIndex(weeklyHours, indexList, NUMBER_OF_WORKERS);// Display resultfor (int i = NUMBER_OF_WORKERS - 1; i >= 0; i--)cout << "Employee " << indexList[i] << ": " <<weeklyHours[i] << endl;return 0;}Exercise6_22#include <iostream>using namespace std;const int COLUMN_SIZE = 5;/** The method for multiplying two matrices */void multiplyMatrix(int a[] [COLUMN_SIZE], int b[] [COLUMN_SIZE], int result[] [COLUMN_SIZE], int rowSize){for (int i = 0; i < COLUMN_SIZE; i++)for (int j = 0; j < COLUMN_SIZE; j++)for (int k = 0; k < COLUMN_SIZE; k++)result[i] [j] += a[i] [k] * b[k] [j];}/** Print result */void printResult(int m1[] [COLUMN_SIZE], int m2[] [COLUMN_SIZE], int m3[] [COLUMN_SIZE], char op, int rowSize){for (int i = 0; i < rowSize; i++){for (int j = 0; j < COLUMN_SIZE; j++)cout << " " << m1[i] [j];if (i == COLUMN_SIZE / 2)cout << " " << op << " ";elsecout << " ";for (int j = 0; j < COLUMN_SIZE; j++)cout << " " << m2[i] [j];if (i == COLUMN_SIZE / 2)cout << " = ";elsecout << " ";for (int j = 0; j < COLUMN_SIZE; j++)cout << " " << m3[i] [j];cout << endl;}}int main(){// Create two matrices as two dimensional arraysint matrix1[5] [5];int matrix2[5] [5];int result[5] [5];// Assign random values to matrix1 and matrix2for (int i = 0; i < 5; i++)for (int j = 0; j < 5; j++){matrix1[i] [j] = rand();matrix2[i] [j] = rand();}multiplyMatrix(matrix1, matrix2, result, 5);cout << "The multiplication of the matrices is " << endl; printResult(matrix1, matrix2, result, '*', 5);}Exercise6_24#include <iostream>using namespace std;int main(){int board[8] [8];for (int i = 0; i < 8; i++){for (int j = 0; j < 8; j++){board[i] [j] = rand() % 2;cout << board[i] [j];}cout << endl;}// Check rowsfor (int i = 0; i < 8; i++){bool same = true;for (int j = 1; j < 8; j++){if (board[i] [0] != board[i] [j]){same = false; break;}}if (same) cout << "All " << board[i] [0] << "'s on row " << i << endl;}// Check columnsfor (int j = 0; j < 8; j++){bool same = true;for (int i = 1; i < 8; i++){if (board[0] [j] != board[i] [j]){same = false; break;}}if (same) cout << "All " << board[0] [j] << "'s on column " << j << endl; }// Check major diagonalbool same = true;for (int i = 1; i < 8; i++){if (board[0] [0] == board[i] [i]){same = false; break;}}if (same) cout << "All " << board[0] [0] << "'s on major diagonal" << endl;// Check subdiagonalsame = true;for (int i = 1; i < 8; i++){if (board[0] [7] == board[i] [7 - i]){same = false; break;}}if (same) cout << "All " << board[0] [0] << "'s on subdiagonal" << endl;return 0;}Exercise6_26#include <iostream>#include <cmath>using namespace std;int lcm(int number1, int number2);int pow(int a, int b);int getPrimeFactors(int number, int table[][2]);int main(){// Enter two integersint number1;cout << "Enter the first integer: ";cin >> number1;int number2;cout << "Enter the second integer: ";cin >> number2;cout << "The LCM for " << number1 << " and " << number2 << " is " << lcm(number1, number2) << endl;}int lcm(int number1, int number2){int table1[100][2];for (int i = 0; i < 100; i++)for (int j = 0; j < 2; j++)table1[i][j] = 0;int i1 = getPrimeFactors(number1, table1);int table2[100][2];for (int i = 0; i < 100; i++)for (int j = 0; j < 2; j++)table2[i][j] = 0;int i2 = getPrimeFactors(number2, table2);int result = 1;int i = 0;int j = 0;while (i < i1 && j < i2){if (table1[i] [0] < table2[j] [0]){result *= pow(table1[i] [0], table1[i] [1]);i++;}else if (table1[i] [0] == table2[j] [0]){result *= pow(table1[i] [0], max(table1[i] [1], table2[j] [1]));i++;j++;}else{result *= pow(table2[j] [0], table2[j] [1]);j++;}}while (i < i1){result *= pow(table1[i] [0], table1[i] [1]);i++;}while (j < i2){result *= pow(table2[j] [0], table2[j] [1]);j++;}return result;}int pow(int a, int b){int result = 1;for (int i = 1; i <= b; i++)result *= a;return result;}int getPrimeFactors(int number, int table[][2]) {int i = 0;int factor = 2;while (factor <= number){if (number % factor == 0){table[i] [0] = factor;while (number % factor == 0){number = number / factor;table[i] [1] ++;}i++;}else{factor++;}}return i;}。

编译原理 第6章习题解答

编译原理 第6章习题解答

第六章习题解答6.1根据语法树,得到下述优先关系:E′*(E T′>+ F>* i>*+<T +<F +<i *<(6.2由文法各条产生式,有然后构造<:FIRST={(Z,b),(M,(),(M,a),(L,M)}FIRST+={(Z,b),(M,(),(M,a),(L,M),(L,(),(L,a)}FIRST*=FIRST+∪{(a,a),(b,b),((,(),( ),)),(Z,Z),(M,M),(L,L)}所以<={(b,(),(b,a),((,M),((,(),((,a))再构造>:LAST={(Z,b),(M,L),(M,a),(L,))}LAST+={(Z,b),(M,L),(M,a),(M,))(L,))}(LAST+)T={(b,Z),(L,M),(a,M),( ),M},( ),L}}(LAST+)T所以>={(L,b),(L,a),(a,b),(a,a),( ),b),(),a)}将这三种关系合并得到表6.1。

利用此算法分析符号串b((aa)a)b是否是文法G[Z]的句子,过程如表6.2所示。

分析成功,符号串b((aa)a)b是文法G[Z]的句子。

表6.1 G[Z]的简单优先关系矩阵表6.2 简单优先分析过程6.3由优先关系矩阵中所示的优先关系:a>c a<b b>b b以及优先函数的定义,应该有f(a)>g(c),f(a)<g(b),f(b)>g(b),f(b)=g(c)则有f(a)>g(c)=f(b)>g(b)>f(a)矛盾。

所以该文法不存在优先函数。

6.4①定义集合∑=N,R={(x,y)∣x,y∈∑,x是y的因子}②定义集合∑=N,R={(x,y)|x,y∈∑,x和y均能被3整除}③定义集合∑=N-{1},R={(x,y)|x,y∈∑,x和y有大于1的公约数}④定义集合∑=N,R为关系“=”6.5关系可以用集合定义,也可以用布尔矩阵表示。

Python语言程序设计(美-梁勇)第6章习题解答(英文)

Python语言程序设计(美-梁勇)第6章习题解答(英文)

Chapter 6 Functions1.At least three benefits: (1) Reuse code; (2) Reduce complexity; (3) Easy to maintain.2. See the Sections 6.2 and 6.3 on how to declare and invoke functions.3. return num1 if (num1 > num2) else num24. True: a call to a function with a void return type is always a statement itself.False: a call to a value-returning function is always a component of an expression.5. A syntax error occurs if a return statement is not used to return a value in a value-returning function. You can have a return statement in a void function, whichsimply exits the function. So, this function is OK, although the return statement isnot needed at all.6. See Section 6.2.puting a sales commission given the sales amount and the commission ratedef getCommission(salesAmount, commissionRate):returns a valuePrinting a calendar for a monthdef printCalendar(month, year):Computing a square rootdef sqrt(value):returns a valueTesting whether a number is even and return true if it isdef isEven(value):returns a valuePrinting a message for a specified number of timesdef printMessage(message, times):Computing the monthly payment, given the loan amount,number of years, and annual interest rate.def monthlyPayment(loanAmount, numberOfYears,annualInterestRate):returns a valueFinding the corresponding uppercase letter given a lowercase letter.def getUpperCase(char letter):returns a value8.Line 2, 5-10: not indented correctly.9.None10.The min function should return a value.11.Using positional arguments requires the arguments be passed in the same order as their respective parameters in the function header. You can also call a function using keyword arguments, passing each argument in the form name=value.12.f(1, p2 = 3, p3 = 4, p4 = 4) # Correctf(1, p2 = 3, 4, p4 = 4) # Not Correctf(p1 = 1, p2 = 3, 4, p4 = 4) # Not Correctf(p1 = 1, p2 = 3, p3 = 4, p4 = 4) # Correctf(p4 = 1, p2 = 3, p3 = 4, p1 = 4) # Correct13. "Pass by value" is to pass a copy of the reference value to the function.14. Yes.15.(A) The output of the program is 0, because the variable max is not changed byinvoking the function max.(B)22 42 4 82 4 8 162 4 8 16 32(C)Before the call, variable times is 3n = 3Welcome to CS!n = 2Welcome to CS!n = 1Welcome to CS!After the call, variable times is 3(D)The code printsi is 11i is 22 1i is 3and then it is an infinite loop.16.17.(A) 23.424(B) 36518.x and y are not defined outside the function.19.Yes. The printout isy is 120.1 25 21 244 521.The parameter with non-default Argument must be defined before the parameter with default arguments.22.The later function definition will replace the previous function definition.23.Yes. The printout is14 4 45 1.824.random.randint(34, 55)25.chr(random.randint(ord('B'), ord('M')))26.5.5 + random.random() * 5027.chr(random.randint(ord('a'), ord('z')))。

第六章练习题及参考解答(第四版)

第六章练习题及参考解答(第四版)

第六章练习题及参考解答6.1表6.5是中国1985-2016年货物进出口贸易总额(Y t)与国内生产总值(X t)的数据。

表6.5 中国进出口贸易总额和国内生产总值单位:亿元(1)建立货物进出口贸易总额的对数lnY t对国内生产总值的对数lnX t的回归方程;(2)检测模型的自相关性;(3)采用广义差分法处理模型中的自相关问题。

【练习题6.1参考解答】回归结果lnŶt=−2.714792+1.152178lnX t(0.316996) (0.027331)t=−8.5641 42.15675R2=0.9834 F=1777.192 DW=0.3069自相关检验①图示法图1、2 e t−1与e t的散点图以及模型残差图由上面两个图可以发现模型残差存在惯性表现,很可能存在正自相关。

②DW检验由回归结果可知DW统计量为0.3069,同时n=32,k=1,在0.05的显著性水平下,d L=1.37,d U=1.50,因而模型中存在正相关。

③BG检验滞后阶数从5阶减小到2阶,AIC及SIC达到最小时,滞后阶数为2阶,此时nR,(2)=5.99,nR2=22.56454>5.99,同时P值为0.0000,在0.05的显著性水平下已知χ20.05拒绝原假设,即存在自相关。

表2 BG检验2阶回归结果自相关补救①DW反算法求ρ由DW=0.3069,可知ρ̂=1−DW2=1−0.30692=0.84655,可得广义差分方程:lnY t−0.84655lnY t−1=β1(1−0.84655)+β2(lnX t−0.84655lnX t−1)+u t表3 广义差分结果-DW反算法DW检验:由回归结果可知DW统计量为1.6284,同时n=31,k=1,在0.05的显著性水平下,d L=1.36,d U=1.50,即已消除自相关。

BG,已知χ20.05(2)=5.99,nR2=0.945667<5.99,同时P值为0.6232,在0.05的显著性水平下不拒绝原假设,即已消除自相关。

编译原理第6章习题答案

编译原理第6章习题答案

P164–7
方法一: S L1.L2 SL L L1B LB B0 B1 {S.val:=L1.val+(L2.val/2 {S.val:=L.val} {L.val:=2*L1.val + B.c; L.length:=L1.length+1} {L.val:=B.c; L.length :=1} {B.c:=0} {B.c:=1}
End Else begin E.type := real; E.code:=E1.code || T.code || inttoreal || + end ET E.type := T.type; E.code:= T.code
T num.num T.type := real E.code:= num.num T num T.type := int E.code:= num
L1.length
L 2.length
)}
;
L.length:=L1.length+1} LB B0 B1 {L.val:=B.val; L.length :=1} {B.val:=0} {B.val:=1}
P165–11
答: D→id L L→, id L1 L→ : T T→integer T→ real {D.type:= L.type;addtype(id.type,L.type)} {L.type:= L1.type;addtype(id.type,L1.type)} {L.type:= T.type} { T.type := integer} { T.type := real}
L 2.length
)}
方法二: 为了用上 B 的综合属性 c, 就要将左递归产生式 L LB 转化为 L BL, 所以设计的求 S.val 的属性文法为: S L1.L2 SL L B L1 {S.val:=L1.val+(L2.val/2 {S.val:=L.val} {L.val:=B.c+L1.val; B.c:=B.val*2
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

《结构化学》第六章习题6001试述正八面体场中,中心离子d 轨道的分裂方式。

6002试用分子轨道理论阐明X-,NH3和CN-的配体场强弱的次序。

6003按配位场理论,在O h场中没有高低自旋络合物之分的组态是:---------------- ( )(A) d3 (B) d4(C) d5(D) d6(E) d76004凡是中心离子电子组态为d6的八面体络合物,其LFSE 都是相等的,这一说法是否正确?6005络合物的中心离子的d 轨道在正方形场中,将分裂成几个能级:---------------- ( )(A) 2 (B) 3 (C) 4 (D) 56006Fe(CN)63-的LFSE=________________。

6007凡是在弱场配位体作用下,中心离子d 电子一定取高自旋态;凡是在强场配位体作用下,中心离子d 电子一定取低自旋态。

这一结论是否正确?6008t,故LFSE为_____________。

Fe(CN)64-中,CN-是强场配位体,Fe2+的电子排布为6g26009尖晶石的一般表示式为AB2O4,其中氧离子为密堆积,当金属离子A占据正四面体T d空隙时,称为正常尖晶石,而当A占据O h空隙时,称为反尖晶石,试从晶体场稳定化能计算说明NiAl2O4晶体是什么型尖晶石结构( Ni2+为d8结构)。

6010在Fe(CN)64-中的Fe2+离子半径比Fe(H2O)62+中的Fe2+离子半径大还是小?为什么?6011作图证明CO 是个强配位体。

6012CoF63-的成对能为21?000 cm-1,分裂能为13?000 cm-1,试写出:(1) d 电子排布(2) LFSE 值(3) 电子自旋角动量(4) 磁矩6013已知ML6络合物中(M3+为d6),f=1,g= 20?000 cm-1,P= 25?000 cm-1,它的LFSE绝对值等于多少?------------------------------------ ( )(A) 0 (B) 25?000 cm-1(C) 54?000 cm-1(D) 8000 cm-16014四角方锥可认为是正八面体从z方向拉长,且下端没有配体L的情况。

试从正八面体场的d 轨道能级图出发,作出四角方锥体场中的能级分裂图,并简述理由。

6015某AB6n-型络合物属于O h群,若中心原子A 的d电子数为6,试计算配位场稳定化能,并简单说明你的计算方案的理由。

6016下列络合物哪些是高自旋的?------------------------------------ ( )(A) [Co(NH3)6]3+(B) [Co(NH3)6]2+(C) [Co(CN)6]4-(D) [Co(H2O)6]3+6017凡是低自旋络合物一定是反磁性物质。

这一说法是否正确?6018Fe的原子序数为26,化合物K3[FeF6]的磁矩为5.9玻尔磁子,而K3[Fe(CN)6]的磁矩为1.7玻尔磁子,这种差别的原因是:------------------------------------ ( )(A) 铁在这两种化合物中有不同的氧化数(B) CN -离子比 F -离子引起的配位场分裂能更大(C) 氟比碳或氮具有更大的电负性(D) K 3[FeF 6]不是络合物6019已知[Fe(CN)6]3-,[FeF 6]3-络离子的磁矩分别为1.7B μ,5.9B μ (B μ为玻尔磁子)( Fe 原子序数26),(1)请分别计算两种络合物中心离子未成对电子数;(2)用图分别表示中心离子 d 轨道上电子排布情况 ;(3)两种络合物其配位体所形成的配位场,是强场还是弱场?6020[FeF 6]3-络离子的磁矩为:------------------------------------ ( )(A) 3B μ (B) 5B μ (C) 2.5B μ (D) 5.9B μ6021已知:CoF 63- △0= 13000 cm -1Co(CN)63- △0= 34000 cm -1P = 21000 cm -1确定上述两种络合物的磁性,并计算其 LFSE (以 cm -1为单位)。

6022试分别用价键理论和晶体场理论推测下列络合物的磁性,并计算其未成对电子数目:[Fe(CN)6]4-, [Fe(CN)6]3-, [Mn(CN)6]4-, [Co(NO 2)6]3-, [Fe(H 2O)6]3+, [CoF 6]3-6023下列配位离子中磁性最大的是:------------------------------------ ( )(A) Mn(H 2O)63+ (B) Fe(H 2O)63+ (C) Fe(CN)64- (D) Co(NH 3)63+(E) Cr(H 2O)62+6024下列哪个络合物的磁矩最大?------------------------------------ ( )(A) 六氰合钴(Ⅲ)离子(B) 六氰合铁(Ⅲ)离子(C) 六氨合钴(Ⅲ)离子(D) 六水合锰(Ⅱ)离子(E) 六氨合钴(Ⅱ)离子6025铁的两种络合物:(A) Fe(CN)6,(B) Na3FeF6,它们的摩尔磁化率大小关系为χA___χB,它们的紫外可见光谱d-d跃迁的波长大小关系为λA___λB。

6026具有平面正方形结构的Cu2+络合物可能会发生多少种能量不同的d-d跃迁?6027配位体CN-,NH3,X-在络离子光谱化学序列中的顺序是____________。

(A) X-<CN-<NH3(B) CN-<NH3<X-(C) X-<NH3<CN-6028某同学测定了三种络合物d-d跃迁光谱,但忘了贴标签,请帮他将光谱波数和络合物对应起来。

已知三种络合物为[ CoF6]3-,[Co(NH3)6]3+,[Co(CN)6]3-,它们的三个光谱波数分别为34?000 cm-1,13?000 cm-1,23?000 cm-1。

6029推测下列三种络合物的d-d跃迁频率大小顺序:------------------------------------ ( )(1)六水合铁(Ⅲ) (2)六水合铁(Ⅱ) (3)六氟合铁(Ⅱ)(A) ν1>ν2>ν3(B) ν1>ν3>ν2(C) ν3>ν2>ν1(D) ν3>ν1>ν2(E) ν2>ν1>ν36030络合物的光谱(d-d跃迁)一般在什么区域?------------------------------------ ( )(A) 远紫外(B) 红外(C) 可见-近紫外(D) 微波6031络化合物中的电子跃迁属d-d 跃迁,用________光谱研究最为合适。

6032在Fe(H2O)62+和Fe(CN)64-中,Fe2+的有效离子半径哪个大?为什么?6033在[PtCl3(C2H4)]-中,哪些因素的影响使得C2H4分子络合前后C—C 键键长发生什么样的变化?6035Jahn-Teller 效应的内容为_____________。

6036在过渡金属络合物中,由于Jahn-Teller 效应使构型发生畸变,若为强场配位体,畸变发生在d7,d9,若为弱场配位体,发生在____________。

6039下列八面体络合物的电子结构中哪个将发生较大的畸变?----------------------------- ( )(A) (t2g)5(e g)2(B) (t2g)3(e g)2(C) (t2g)4(e g)2(D) (t2g)6(e g)36040下列络合物的几何构型哪一个偏离正八面体最大?------------------------------------ ( )(A) 六水合铜(Ⅱ) (B) 六水合钴(Ⅱ) (C) 六氰合铁(Ⅲ)(D) 六氰合镍(Ⅱ) (E) 六氟合铁(Ⅲ)6041下列配为位离子中,哪个构型会发生畸变?------------------------------------ ( )(A) Cr(H2O)63+(B) Mn(H2O)62+(C) Fe(H2O)63+(D) Cr(H2O)62+6042下列八面体络合物中,哪些会发生畸变?为什么?Ni(H2O)62+,CuCl64-,Cr(CN)63-,Co(NH3)62+6043根据Jahn-Teller 效应,说明下列配位离子的几何构型:Fe(H2O)62+,Fe(CN)64-,CuCl64-,FeF64-,Ni(CN)64-6044Ni2+的低自旋络合物常常是平面正方形结构,而高自旋络合物则多是四面体结构,试用杂化轨道理论解释之。

6045为什么Mn3+的六配位络离子为变形八面体,而Cr3+的配位络离子为正八面体构型?6046下列四种过渡金属络离子中,具有理想正八面体构型的有:------------------------- ( )(A) [Cr(NH3)6]3+(B) [Cu(NH3)6]2+(C) 高自旋[Mn(H2O)6]2+(D) 低自旋[Fe(CN)6]3-6047Ni2+有两种络合物,根据磁性测定知[Ni(NH3)4]2+是顺磁性,[Ni(CN)4]2-为反磁性,试推测其空间结构。

( Ni 的原子序数为28)6048写出八面体形的Co(en)33+及[Co(NH3)4Cl2]+可能出现的异构体。

6049写出八面体形的[Co(en)(NH3)2Cl2]+可能出现的异构体。

6050指出ZnCl42-,Ni(CN)42-,Mn(H2O)42+,TiCl4,Ni(CN)53-的配位多面体的结构型式。

6051正八面体络合物MA6中的三个配位体A 被三个B 取代,所生成的络合物MA3B3有多少种异构体?这些异构体各属什么点群?6052单核羰基络合物Fe(CO)5的立体构型为:------------------------------------ ( )(A) 三角双锥(B) 四面体(C) 正方形(D) 八面体(E) 三角形6053四羰基镍的构型应为:------------------------------------ ( )(A)正八面体(B)平面三角形(C)四面体(D)正方形6054CO 与过渡金属形成羰基络合物时,CO 键会:------------------------------------ ( )(A)不变(B)加强(C)削弱(D)断裂6055Ni(CO)4中Ni 与CO 之间形成:------------------------------------ ( )(A)σ键(B) π键(C) σ-π键6066Mn(CO)4NO 是否符合18 电子规律?6067羰基络合物中,CO 键的键长比CO 分子键长应:------------------------------------ ( )(A) 不变(B) 缩短(C) 变长6071用配位场理论估算下列离子的不成对电子数:(a) MnO43-(b) NiI42-(c) MoCl63-(d) Au(CN)4-(e) Ru(NH3)63+6072求算下列离子的配位场稳定化能( LFSE,以△0为单位)。

相关文档
最新文档