Graphics Programming using Allegro

Practice Test

Processing Pixels in Images of Unknown Size

Published:  September 10, 2008
By Richard G. Baldwin

File: Allegro00150PracticeTest


Questions

1.  True or False:  There is no minimum width for an Allegro graphics window running under Windows.

Answer and Explanation

2.  True or False:  There is a minimum width for an Allegro graphics window running under Windows.

Answer and Explanation

3.  True or False:  When loading a truecolor image into a memory buffer, there is no required order in which you must set the graphics mode and call the load_bitmap function (or call set_color_conversion) to load the image.

Answer and Explanation

4.  True or False:  When loading an image into a memory buffer, if the file contains a truecolor image, you must set the video mode (or call set_color_conversion) before loading it.

Answer and Explanation

5.  True or False:  The function named get_clip_rect can be called to determine the coordinates of the diagonal corners of the current clip rectangle for an image.

Answer and Explanation

6.  True or False:  The function named get_clip_rect can be called to determine the coordinates of the upper-left corner along with the width and the height of the current clip rectangle for an image.

Answer and Explanation

7.  True or False:  When you call the function named get_clip_rect, among other parameters, you must pass the names of four variables of type int.  The coordinate values for the diagonal corners will be deposited into these four variables.

Answer and Explanation

8.  True or False:  When you call the function named get_clip_rect, among other parameters, you must pass the addresses of four variables of type int.  The coordinate values for the diagonal corners will be deposited into these four variables.

Answer and Explanation

9.  True or False:  Assuming that the clip rectangle of an image has not been modified since it was loaded into memory, the function named get_clip_rect can be called to get information that will allow you to compute the width and height of an image.

Answer and Explanation

10.  True or False:  The function named get_clip_rect is very useful for displaying an image but it cannot be used to compute the size of an image.

Answer and Explanation

11.  True or False:  If the variable named width in the statement shown below is type float, the result of the computation will always be evenly divisible by 4.


    windowWidth = (width/4)*4 + 4;

Answer and Explanation

12.  True or False:  If the variable named width in the statement shown below is type int, the result of the computation will always be evenly divisible by 4.


    windowWidth = (width/4)*4 + 4;

Answer and Explanation

13.  True or False:  The sprintf function provides a convenient mechanism for converting numeric data to a text string for display in an Allegro graphics window.

Answer and Explanation

14.  True or False:  The scanf function provides a convenient mechanism for converting numeric data to a text string for display in an Allegro graphics window.

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 14

False - sprintf, not scanf

Explanation 14

Back to Question 14


Answer 13

True

Explanation 13

Back to Question 13


Answer 12

True

Explanation 12

Back to Question 12


Answer 11

False - true only if width is an integer type

Explanation 11

Back to Question 11


Answer 10

False

Explanation 10

Back to Question 10


Answer 9

True

Explanation 9

Back to Question 9


Answer 8

True

Explanation 8

Back to Question 8


Answer 7

False - you must pass the addresses of the four variables

Explanation 7

Back to Question 7


Answer 6

False - gets coordinates of diagonal corners

Explanation 6

Back to Question 6


Answer 5

True

Explanation 5

Back to Question 5


Answer 4

True

Explanation 4

Back to Question 4


Answer 3

False

Explanation 3

Back to Question 3


 

Answer 2

True - the minimum width is about 108 pixels

Explanation 2

Back to Question 2


Answer 1

False - the minimum width is about 108 pixels

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-