问题 单项选择题

若程序中定义了局部变量与全局变量,则()

A.在函数内只能访问局部变量,不能访问全局变量

B.局部变量与全局变量的名字不得相同

C.一个函数被多次调用时,其定义的局部变量必定分配同一个存储单元

D.函数中定义的局部变量与全局变量同名时,在函数内引用的是局部变量

答案

参考答案:D

解析:

本题考查程序语言的基本概念。

在高级语言程序中,变量的作用域(引用变量的代码范围)可能是全局的或者是局部的。对于全局变量,其作用域是整个程序(或文件),因此在函数内可以访问全局变量,而局部变量的作用域为声明(定义》该变量的函数(过程,子程序)。一般语言都规定,若全局变量和局部变量的名称相同,则在局部变量的作用域范围内,引用的是局部变量 (即最近嵌套原则)。程序运行过程中,每次调用一个函数时,都在栈区为该函数的运行创建活动记录(主要包括函数运行时需要的数据和控制信息),函数运行结束后则释放为其分配的活动记录。因此,函数多次运行时,其定义的局部变量不一定分配同一个存储单元。

选择题
填空题

Crash-Prone The Solution Could Be Windows XP;
But does It Make Sense to Upgrade Your Operating System


You can hardly turn on the television or click on a Web page without seeing a colorful ad for Microsoft’s new Windows XP operating system, which launched on Oct. 25.
So, now that the long-awaited XP is here, what are you going to do about it Should you upgrade, and if you do, how hard is it and what are the potential drawbacks The decision is pretty easy if you really need a whole new Windows PC. They all come with XP preloaded, and in my tests of a few such models, they seemed to work well. I’m writing this on my own new personal computer, a Dell that came preloaded with Windows XP, and it worked great right out of the box.
The only downside is that if you’re keeping older printers, scanners and other peripherals, you may have to download new "drivers" — the small programs that allow a PC and a peripheral to interact. XP contains many of the drivers for recent-model printers and the like, sparing you from even digging out the disks that came with them. But if you have older equipment, you may have to download new drivers, because the original software that came with the hardware might not work with Windows XP.
It’s harder to decide what to do about XP if you have a PC that doesn’t need replacing. If you’re happy with the way things are working, don’t upgrade. It’s never a trivial thing to change operating systems, and you shouldn’t do it without a reason.
However, there are two big limitations in prior versions of Windows that XP does fix, and that might make an upgrade worthwhile. These are stability — that is, the ability not to crash, or at least to do so rarely — and compatibility. Windows 98 and Windows ME, the previous consumer versions, had wide compatibility with consumer software and peripherals, but lousy stability. Windows 2000, the prior business version, had great stability, but limited compatibility with consumer software and add-on hardware.
Windows XP is designed to combine the stability of Windows 2000 (with which it shares underlying code) with the compatibility of Windows 98 and Windows ME, and in my experience, it does a good job at that. So if you need more reliability or compatibility than your current version of Windows supplies, an upgrade may be in order.
But there’s a catch. Microsoft says that an XP upgrade will really be sensible only if your PC is two years old or less — built after 1999. And you need at least a 300MHz processor and 128 megabytes of memory, though I recommend at least 192MB, and 256MB is even better. Also, you’ll need a roomy hard disk — Windows XP alone will suck up 1.5 gigabytes.
So there are only a limited number of PCs for which upgrading makes sense, and you may have to invest in beefing yours up first.
Not only that, but you must have Windows 98, Windows ME or Windows 2000 on your current system to upgrade. If you have Windows 95 and somehow still have a new enough machine to qualify, you have to buy a very expensive, "full" version of Windows XP, basically wipe out your whole hard disk and start from scratch with XP, losing all your installed programs and settings.
If you’re good to go, you next have to decide which upgrade version of XP is right for you — the $99 Home Edition or the $199 Professional. The differences between them are surprisingly small, and 95 percent of home and small-business users will be fine with the home version. Buy the pro version only if you are running more than a modest network or need special security features.
Note that if you have Windows 2000, or NT 4.0, you can upgrade only to Windows XP Professional, not the Home Edition. If you have Windows 98 or ME, you can choose either flavor of XP.
In my tests, which included five PCs running all the main older versions; the Windows XP upgrades, both home and pro, went very smoothly.
The process took about an hour in each case, and the installation software was friendly and clear in its instructions and progress reports.

You may have to download new "drivers" if you have a whole new Windows PC ______.
A. but recent-model peripherals
B. but older peripherals
C. but older software
D. but old disks