This is a pretty subjective question, because the background of programmers varies from person to person. Some programmers work at much higher application-building levels, using tools like .NET and other integrated development environments to do their major work, and others are more experienced in lower-level programming, perhaps working with system calls or even the computer’s instruction set itself (i.e. usually using the native assembly language).
How much “from scratch” do you mean? Are we talking about purchasing a motherboard, case, processor, fans, etc etc and putting all the parts together? Or are we talking about actually creating the motherboard and all the circuitry itself from raw materials?
I’m a programmer, and personally I could do the former, but the latter would probably require specialized tools I don’t have, and further research on my part. You see, my specialty is computer science, not electrical engineering. So while I can understand the circuit designs, even perhaps down to the AND / OR gates, flip-flops, registers, and so forth, I wouldn’t feel comfortable with the physical tasks of soldering all the pieces together, the electrical aspects (building a power supply from scratch), etc. So how much “from scratch” are we really talking about?
Generally speaking, I would say that a good programmer who has actually gotten a good background in Computer Science (and not just, say, a .NET certification) is likely to have a decent understanding of how a computer works at least to the level of understanding its hardware components, how they fit together, and probably a good bit about the instruction sets of computers, how assembly languages work, registers and memory, devices and interrupts, and a variety of other hardware aspects. Some may even have learned about integrated circuit design (I had a course in Digital Networks, myself, when working on my CS degree).
Programmers who learned just a specialized high-end language or environment or two, and who primarily build things at that application level – are probably less likely to know the deep details, although I think a good programmer of ay stripe would have the ability to figure out how to put a computer together from pre-fabricated parts (motherboard, power supply, processor, etc) easily, just by reading the manual that comes with a motherboard. Not that all would know this already – but it wouldn’t be hard to train oneself to do it.
But overall, it varies from programmer to programmer. Different people work at different levels of abstraction in their day-to-day programming tasks. Some write device drivers and must be intimately familiar with certain aspects of hardware. Others write web applications and only need to work with high-level concepts, and usually would not need to interact with the hardware directly. Others work on operating systems and are constantly interacting with the computer’s native instruction set. This is why much of what is built in computer systems (at least well-designed systems) is set up in layers of abstraction, so that a person working at one specific level only needs to focus on that level. (A better programmer will understand more than just one level, though).
I’d say that programmers who have to work at the operating system or device driver level will generally have a better deep understanding of the hardware than the high-end application developer. But in computer science, there’s always something else to learn. I seriously doubt any one person knows it ALL – but that’s no reason I shouldn’t strive for that!