Graphics Programming using Allegro

Practice Test

Hello World

Published:  September 7, 2008
By Richard G. Baldwin

File: Allegro00110PracticeTest


Questions

1.  True or False:  When you write an Allegro program, you must include the header file named iostream.

Answer and Explanation

2.  True or False:  When you write an Allegro program, you must include the header file named allegro.h.

Answer and Explanation

3.  True or False:  While not required, an optional call to the function named allegro_init can expose additional Allegro capabilities.

Answer and Explanation

4.  True or False:  After you call the function named install_keyboard, you can use any of the keyboard input routines including operating system calls and C library functions to access the keyboard.

Answer and Explanation

5.  True or False:  The following function call sets the graphics mode to a full-screen window.

  set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320,240,0,0);

Answer and Explanation

6.  True or False:  The standard configuration of Allegro supports five alternative graphics modes that behave in different ways.

Answer and Explanation

7.  True or False:  The call to the textout_ex function shown below draws the text "HELLO WORLD" on a command-line screen similar to the use of a cout statement in standard C++.

  textout_ex(screen,//Specify bitmap on the screen
             font,//Use a default font
             "HELLO WORLD",//Specify the text to display
             20,//X-coordinate for text
             30,//Y-coordinate for text
             makecol(255,255,0),//Color text yellow
             makecol( 255,0,0) );//Put red behind text

Answer and Explanation

8.  True or False:  Transparency with regard to text is achieved by setting either or both of the color parameters in a call to textout_ex to a value of 256.

Answer and Explanation

9.  True or False:  A call to the readKey function returns the next character from the keyboard buffer in ASCII format.

Answer and Explanation

10.  True or False:  According to the documentation at allegro.cc, in order to maintain cross-platform compatibility, you must put the macro shown below at the very end of your main function.  This macro requirement is specific to Allegro.

END_OF_MAIN()

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 10

True

Explanation 10

Back to Question 10


Answer 9

True

Explanation 9

Back to Question 9


Answer 8

False  -1, not 256

Explanation 8

Back to Question 8


Answer 7

False

Explanation 7

Back to Question 7


Answer 6

True

Explanation 6

Back to Question 6


Answer 5

False

Explanation 5

Back to Question 5


Answer 4

False

Explanation 4

Back to Question 4


Answer 3

False - not optional

Explanation 3

Back to Question 3


 

Answer 2

True

Explanation 2

Back to Question 2


Answer 1

False

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-