Graphics Programming using Allegro

Practice Test

Controlling Individual Pixels, Painting a Frame with Color

Published:  September 8, 2008
By Richard G. Baldwin

File: Allegro00130PracticeTest


Questions

1.  True or False:  Drawing individual pixels directly on the screen can be slow.  If you call the putpixel function to change the color of every pixel in a 256x256 graphics window, unless you have a very fast computer, you will probably be able to see the pixels change color.

Answer and Explanation

2.  True or False:  Drawing individual pixels directly on the screen is a very fast process.  If you call the putpixel function to change the color of every pixel in a 256x256 graphics window, unless you have a very slow computer, you probably won't be able to see the pixels change color.

Answer and Explanation

3.  True or False:  One way to control the color of every pixel in a bitmap image is to use a pair of nested for loops.  The outer loop can be used to iterate on the rows of pixels.  The inner loop can be used to iterate on the columns of pixels.  A call to the putpixel function inside the inner loop can be used to set the color of each pixel to the desired color for that pixel.

Answer and Explanation

4.  True or False:  One way to control the color of every pixel in a bitmap image is to three nested for loops.  The outer loop can be used to iterate on the rows of pixels.  The loop between the outer loop and the inner loop can be used to iterate on the columns of pixels.  The inner loop can be used to iterate on the color depth.  A call to the set_color_depth function inside the inner loop can be used to set the color of each pixel to the desired color for that pixel.

Answer and Explanation

5.  True or False:  One way to improve the speed of a program that directly controls the colors of individual pixels is to control the color of the pixels in an off-screen bitmap image buffer and copy the off-screen buffer to the screen when the time comes for it to be viewed.

Answer and Explanation



Copyright 2008, Richard G. Baldwin.  Reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.

Richard Baldwin is a college professor (at Austin Community College in Austin, TX) and private consultant whose primary focus is a combination of Java, C#, and XML. In addition to the many platform and/or language independent benefits of Java and C# applications, he believes that a combination of Java, C#, and XML will become the primary driving force in the delivery of structured information on the Web.

Richard has participated in numerous consulting projects and he frequently provides onsite training at the high-tech companies located in and around Austin, Texas.  He is the author of Baldwin's Programming Tutorials, which have gained a worldwide following among experienced and aspiring programmers. He has also published articles in JavaPro magazine.

In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP).  His first job after he earned his Bachelor's degree was doing DSP in the Seismic Research Department of Texas Instruments.  (TI is still a world leader in DSP.)  In the following years, he applied his programming and DSP expertise to other interesting areas including sonar and underwater acoustics.

Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.

Baldwin@DickBaldwin.com

 


Answers and Explanations


Answer 5

True

Explanation 5

Back to Question 5


Answer 4

False - this statement is simply nonsense

Explanation 4

Back to Question 4


Answer 3

True

Explanation 3

Back to Question 3


 

Answer 2

False

Explanation 2

Back to Question 2


Answer 1

True

Explanation 1

Back to Question 1


Copyright 2008, Richard G. Baldwin.  Reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.

Richard Baldwin is a college professor (at Austin Community College in Austin, TX) and private consultant whose primary focus is a combination of Java, C#, and XML. In addition to the many platform and/or language independent benefits of Java and C# applications, he believes that a combination of Java, C#, and XML will become the primary driving force in the delivery of structured information on the Web.

Richard has participated in numerous consulting projects and he frequently provides onsite training at the high-tech companies located in and around Austin, Texas.  He is the author of Baldwin's Programming Tutorials, which have gained a worldwide following among experienced and aspiring programmers. He has also published articles in JavaPro magazine.

In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP).  His first job after he earned his Bachelor's degree was doing DSP in the Seismic Research Department of Texas Instruments.  (TI is still a world leader in DSP.)  In the following years, he applied his programming and DSP expertise to other interesting areas including sonar and underwater acoustics.

Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.

Baldwin@DickBaldwin.com

 

-end-