AdSense

AdSense3

Monday 1 December 2014

COMPUTER GRAPHICS


1. Smallest size object that can be displayed on a monitor is called ..................... a) Picture element b) Point  c)Dot Pitch d) aspect ratio Ans: Picture element
2. Each screen point is referred to as ......................... a) Resolution b)Pixel  c)Persistence d)Dot Pitch Ans: Pixel
3. On a monochromatic monitor, the frame buffer is known as ......................   a) Display file b) Pixmap c) Bitmap d) Refresh buffer Ans: Bitmap
4. On a color monitor, the refresh buffer is also called .....................  a)Frame buffer b)Pixmap c)Bitmap d)Display file Ans: Pixmap
5. ..................  refers to pixel spacing.  a)Pixmap b)Resolution c)Pixel depth d)Persistence Ans: Resolution
6. The distance from one pixel to the next pixel is called ...........  a)Resolution b)Dot Pitch c)Pixmap d)ppi Ans: Resolution
7. The maximum number of  points that can be displayed without overlap on a CRT  a)Aspect Ratio b)Resolution c)Brightness d)Pixel Ans: Resolution
8. ..................... is the number of points per centimeter that can be plotted horizontally and vertically.  a)Aspect Ratio b)Pixel Depth c)Resolution d)Dot Pitch Ans: Resolution
9. ...................... is the ratio of horizontal points to vertical points necessary to produce equal length lines in both direction.  a)Dot Pitch  b)Resolution c)Aspect Ratio d) Height-Width Ratio Ans: Aspect Ratio
 10. Identify the odd one out from the following   a)Frame Buffer b)Pixmap c)Display program d)Refresh Buffer Ans: Pixmap
11. The shortest distance between any two dots of the same color is called ...................  a)Resolution b)Dot Pitch c)Pixel Depth d)ppi Ans: Dot Pitch  12.  The standard aspect ratio for PC is .................  a) 6:5 b) 4:3 c)3:2 d)5:3 Ans: 4:3
13. In CRT, the electron intensity is adjusted using .................  a) Accelerating anode b) Control grid  c) Electron gun  d) Focusing anode Ans: Control grid
14. Brightness of a display is controlled by varying the voltage on the ......................  a) Focusing anode b)Connection pins c)Control grid d)Power supply Ans: Control grid
15. Lower persistence phosphorus is used in a) Animation b) Simple object c) Complex object d) All of these Ans: Animation
16. Lower persistence phosphorus needs_________ refresh rate  a) Lower b)Higher c)Medium d)None of these Ans: Higher
17.. Higher persistence phosphorus needs _________ refresh rate  a) Lower b)Higher c)Medium d)None of these Ans: Lower
18. Higher persistence phosphorus is used in a) Animation b) Simple object c) High Complex object  d) All of these Ans: High Complex object  
15. Memory area holding the intensity information of an image is called ..............  a)Refresh buffer b)Font cache c)Picture definition d)Video controller Ans: Refresh buffer
16. Intensity representation of an image is called ......................  a)Frame buffer b)Picture definition c)Display list d)Brightness Ans: Picture definition
17. The purpose of  refreshing a CRT is ..........................
 a)To avoid flickering b)To maintain steady picture   c)To avoid fading of pixels d)All of the above Ans: All of the above
18. The fly-back of electron beams from one scanline to next is known as ....................  a)Vertical Retrace b)Horizontal Retrace c)Raster scanning d)Refreshing Ans: Horizontal Retrace
19. The return of electron beam to top left corner of the screen after one frame is called ............  a)Horizontal fly-back b)Vertical Fly-back c)Scanning d)None of the above Ans: Vertical Fly-back
20. In raster scan display, the frame buffer holds ......................  a)Line drawing commands b)Scanning instructions  c)Image Resolution d) Intensity information Ans: Intensity information   21. In random scan display, the frame buffer holds ......................  a)Line drawing commands b)Scanning instructions  c)Image Resolution d) Intensity information Ans:  Line drawing commands  
22. Identify the odd one out from the following  a)Vector display b)Raster scan display c)Calligraphic display  d)Stroke-writing display Ans: Raster scan display
22. Interlaced refresh procedure is allowed in ..................   a) LCD b)DVST c)Raster scan display d)Random scan display Ans: Raster scan display
23. Vector display is well suited for .................  a) Animation b) Line drawing applications c) Cartoons d) All of the above Ans: Line drawing applications  
24. Beam penetration method is usually used in ...............................  a)LCD b)Raster Scan display c) Random scan display  d)DVST Ans: Random scan display
25. Shadow mask  method is usually used in ...............................  a)LCD b)Raster Scan display c) Random scan display  d)DVST Ans : Raster Scan display  
26. Identify the colors produced in beam penetration method.  a) Red, Green, Blue, White  b)Red, Orange, Yellow, Green  c)Red, Green, Blue   d) Green, Red, White, Orange Ans : Red, Orange, Yellow, Green
 27. An RGB color system with 24 bits os storage per pixel is known as ........................  a) Color CRT b)True-color system c)RGB monitor  d)Color- Depth Ans: True-color system    
28. Identify the features of Vector display  a)High resolution, Jagged lines, Lack in color depth  b)Smooth lines, Poor resolution,  Black & White  c)High resolution, Lack in color depth, Smooth lines  d)Inexpensive, monochromatic, smooth lines Ans: High resolution, Jagged lines, Lack in color depth
29. Identify different type of computer graphics  a) Monochrome and Color  b)CRT and Flat panel    c)Vector an Raster   d)Monitors and Hardcopy devices Ans: Vector an Raster
30. DVST stands for ..........................  a)Digital View Storing Table b)Direct Visual Storage Tube   c)Direct View Storage Tube  c)Digital View Storage Tube Ans: Direct View Storage Tube  
31. Refreshing is not needed in DVST because of the presence of .................  a) Primary gun b) Flood gun c) Focusing anode d)Control grid Ans: Flood gun
32. In DVST, the electron beam from primary electron gun strikes on ..............  a) Phosphor screen b) Collector mesh c)Storage mesh d) Flood gun Ans: Storage mesh
33. The purpose of flood gun in DVST is ...........................  a) To store the picture pattern b) To slow down the flood electrons    c) To enable color pixels  d) To focus the electron beam Ans: To slow down the flood electrons  
34. Identify the features of DVST from the following.  a) Monochromatic, Flicker free, Low resolution b)Monochromatic, Flicker free  c) Color screens, Refresh monitors, High resolution d)Expensive, Low resolution Ans: Monochromatic, Flicker free
35. Video devices with reduced volume, weight and power consumption are collectively known as .........
 a) Light weight monitors b)Flat-panel displays c)CRT d) Portable display Ans: Flat panel displays  
36. Pick out the odd one out  a) LED b)LCD c) Gas Discharge tube d) Plasma Panel Ans: LCD
37. Match the following   Part A     Part B A. Plasma panel    i) Polarizer B. DVST     ii) Zinc sulfide C. LCD     iii) Dielectric mesh D. Thin film electroluminescent   iv)Neon gas
       a) A-ii, B-iv, C-i, D-iii b) A-ii, B-iii, C-iv, D-i         c) A-iv, B-iii, C-i, D-ii d) A-i ,B-iv, C-ii, D-iii Ans:   A-iv, B-iii, C-i, D-ii
38. ................... is responsible for accessing the frame buffer to refresh the screen.  a) Graphics package  b) Video controller c) CPU  d) Monitor Ans: Video controller
39. Digitizing a picture definition into a set of intensity values is known as .............  a) Digitization b) Scan conversion c)Refreshing d) Scanning Ans: Scan conversion
40. ....................... will free the CPU from graphics chores.  a) Display processor b) Monitor c) ALU  d)Video controller Ans: Display processor
41. Write an example for non-emissive displays  a) LED b)LCD c) Gas Discharge tube d) Plasma Panel Ans: LCD
42. Identify impact printer from the following  a) Drum Plotter b)Inkjet printer c)Electrostatic printer d) Dot-matrix printer Ans: Dot-matrix printer
45. Write an example for non-impact printer  a) Drum plotter b) Electrostatic printer c) Laser printer  d) All of the above Ans: All of the above
46. Identify the odd one out.  a) Mouse b) Keyboard c) Trackball d) Space ball Ans: Keyboard
47. GIF stands for ......................  a) Global Image Format b) Graphics Interchange Format    c) Graphics Image Format d) None of the above Ans: Graphics Interchange Format
48.  The ................ simply reads each successive byte of data from the frame buffer.  a) Digital Controller  b) Data Controller c) Display Controller d) All of above Ans:  Display Controller
49. The refresh rate below which a picture flicker is ................  a) 25 b) 30 c)35 d)60 Ans: 25
50. ........ used to regulate the flow of elections in CRT ?  a) Electron gun b) Focusing anode c) Control grid d) All of the above Ans: Control grid
51. The technique used to summarize the financial, statistical, mathematical,scientific and economic data is ?  a) Computer Art b) Image processing c) Presentation Graphics d)None of the above Ans:  Presentation Graphics
52. Graphics and image processing technique used to produce a transformation of one object into another is called  a) Animation b) Morphing c) Half toning d) None of the above  Ans: Animation
53. The amount of light emitted by the phosphor coating depends on the?   a) Number of electrons striking the screen  b) Speed of electrons striking the screen  c) Distance from the cathode to the screen  d)None of above Ans: Number of electrons striking the screen
54. Gray scale is used in ............................  a) A Monitor that have color capability  b) A Monitor that have no color capability  c) Random scan display  d) Raster scan display Ans: A Monitor that have no color capability
55.  A wireless mouse works on
 a) Infra blue radiation b) Infra Red radiation c) X-rays d) UV rays Ans: Infrared radiation
56.   Vector graphics is composed of  a. Pixels b.  Paths c. Palette` d. None of these Ans: Paths
57.  Raster graphics are composed of      a.      Pixels b.      Paths c.       Palette d.      None of these  Ans: Pixels    58.  EPS image file format is used for        a) Vector graphics b) Bitmap c) Both a & b d)    None of these  Ans: Both a & b
 59.   TIFF (tagged image file format )are used for        a.       Vector graphics  b.      Bitmap c.       Both a & b d.       None of these  Ans: Bitmap
60. Two dimensional color model are        a.       RGB and CMKY  b.       RBG and CYMK c.       RGB and CMYK d.       None Ans: RGB and CMYK
 61.   RGB model are used for        a.      Computer display b.       Printing c.       Painting d.       None of these  Ans: Computer display
 62.   CMYK model are used for       a.       Computer display b.      Printing c.       Painting d.       None of these  Ans: Printing
 63.   The intersection of three primary RGB color produces        a.      White color b.       Black color c.       Magenta color d.       Blue color  Ans: White color  
 64.   The intersection of primary CMYK color produces        a.       White color b.      Black color c.       Cyan color d.       Magenta color  Ans: Black color
65.    Random scan systems are designed for       a.      Line drawing application b.       Pixel drawing application       c.       Color drawing application d.       None of these Ans: Line drawing application
66.    A major disadvantage of DVST in interactive computer graphics is          a) Ability to selectively erase part of an image   b)  Inability to selectively erase part of image from screen   c) Inability to produce bright picture
  d) None  Ans: Inability to selectively erase part of image from screen  
67. Which of the following allow for 8 mirror images?  a) Parabola b)Ellipse c)Hyperbola d) Circle Ans: Circle
68. The simplest output primitive is .............  a) Straight line  b) Straight line segment  c) Point  d)Circle Ans: Point
69. A bitmap is .............. bit(s) per pixels.  a) 0 b)1 c)2 d)4 Ans: 1
70. The intensity of a grayscale pixel is expressed within a given range between a minimum and a maximum   a) 1 and 2 b) 2 and 1 c) 0 and 1 d)0 and 2 Ans: 0 and 1
71. Each pixel has ________basic color components  a.       Two or three b.       One or two c.       Three or four d.       None of these Ans: Three or four
72.   The quality of an image depend on  a.      No. of pixel used by image  b.       No. of line used by image  c.       No. of resolution used by image  d.       None  Ans:   No. of pixel used by image  
73. The basic geometric structures that describes a scene on display is called .................  a) Attributes b) Output primitive c) Lines  d) Curves Ans: Output primitive
74. ..................... controls the basic display properties of output primitives.  a) Attribute parameter b) setpixel c) getpixel d) None of the above Ans: Attribute parameter
75. To set line width attributes in a PHIGS  package, ................... function is used.  a) setLineThickness(lw)   b)setLineWidth(lw)    c) setLineWidthScaleFactor(lw)  d)setPolylineWidth(lw) Ans:  setLineWidthScaleFactor(lw)  
76. Identify the values for fill-style parameter from the following  a) Hollow b)Hatch  c) Pattern d)All of the above Ans: All of the above
77. ...................... function is used to set the basic fill style.
 a) setFillStyle(fs) b) setFillStyleIndex(fs)  c) setInteriorStyle(fs) d)FillType(ft) Ans: setInteriorStyle(fs)
78. ..................... is defined as the distance between the baseline and cap line of the character body.  a) Character Size b) Character Height c) Character Width d)Character Length Ans: Character Height
80. ............... function is used to change the size of a character without changing the height:width ratio.  a)setTextSize(ts) b)setCharacterHeight(ch) c)setCharacterSize(cs) d)setTextHeight(th) Ans: setCharacterHeight(ch)
81. .................. will define a group of attribute values of each primitive to be used on a monitor  a) Primitive table b)Bundle table c) Attribute table d) None of the above Ans: None of the above
82. ............. function is used to set how text is to be positioned with respect to the start coordinates  a) setTextAlignment(h,v) b)setTextPrecision(tp) c)setTextPosition(h,v) d)setText(ts) Ans: setTextAlignment(h,v)
83. ................ is used to check the current status of each attributes    a)  setpixel  b)getpixel c)inquiry function d)status function Ans: Inquiry function
84. The basic transformations include   a) Translation b)Rotation c)Scaling d) All of the above Ans: All of the above
85. The transformation in which an object is moved in a minimum distance path from one position to  another is called  a) Rotation b) Replacement  c) Translation d) Scaling Ans: Translation
86. The translation distances (dx, dy) is called as a) Translation vector b) Shift vector c) Both a and b  d) Neither a nor b Ans: Both a and b
87. The two-dimensional translation equation in the matrix form is a) P’=P+T b) P’=P-T c) P’=P*T d) P’=p
88. The transformation in which an object is moved from one position to another in circular path around a specified pivot point is called
 a) Rotation  b) Shearing c) Translation d) Scaling Ans: Rotation
89. The transformation in which the dimension of an object are changed relative to a specified fixed point is called  a) Rotation  b) Reflection c) Translation d) Scaling Ans: Scaling
90. The transformation that produces a parallel mirror image of an object are called  a) Rotation  b) Reflection c) Translation d) Scaling Ans: Reflection
91. If an object is rotated through an angle A in clockwise direction, the rotation matrix R= ...............  a) cos A sin A  b)  cos A -sin A  c) sin A  cos A d) None      -sin A cos A       sin A cos A      cos A  sin A Ans:    cos A   sin A           -sin A   cos A
92. If a point (x,y) is reflected about an axis which is normal to the XY plane and passing through the origin, the reflected point (X,Y) is:-  a) (x,-y) b) (-x,y) c) (-x,-y) d) (y,x) Ans: (-x,-y)
93. Reflection of a point about x-axis, followed by a counter-clockwise rotation of 900 , is equivalent to      reflection about the line ?  a) x= -y b) x=0 c)x=y d) x+y=1 Ans: x=y
94. A circle, if scaled only in one direction becomes a ?  a) Hyperbola b)Ellipse c) Parabola d)remains a circle Ans: Ellipse
95. (2,4) is a point on a circle that has center at the origin. Which of the following points are also on    circle ?  a) (2,-4) b) (-2,4) c) (-4,-2) d) All of above Ans: All of above
96. Which  technique of color CRT is used for production of realistic image  a) Beam penetration  b) Shadow mask c) both a&b d)None of above Ans: Shadow mask   97. A composite transformation matrix can be made by determining the ________of matrix of the individual transformation  a) Sum b) Product c) Difference d) None of the above Ans: Product
98. Each successive transformation matrix _________ the product of the preceding transformation
 a) pre-multiplies b) post-multiplies c) adds  d)subtracts  Ans: pre-multiplies
99. Which of the following is not a rigid body transformation?  a) Translation b) Rotation c) Shearing d) Reflection Ans: Shearing
100. Forming products of transformation matrices is often referred as  a) Concatenation b) Composition c) both a&b d) None of above Ans: both a&b
101.  Two consecutive translation transformation t1 and t2 are  a) Additive b) Multiplicative c) Subtractive d) none of above Ans: Additive
102. Two consecutive rotation transformation r1 and r2 are  a) Additive b) Multiplicative c) Subtractive d) none of above Ans: Additive
103. Two consecutive scaling transformation s1 and s2 are  a) Additive  b) Multiplicative c) Subtractive d) none of above Ans: Multiplicative
104. The process of mapping a world window in world coordinate system to viewport are called  a) Transformation viewing  b) Viewport   c) Clipping window   d) Screen coordinate system Ans: Transformation viewing  
105. The process of extracting a portion of a database or a picture inside or outside a specified region are called   a) Transformation b) Projection c) Clipping d) Mapping Ans: Clipping  
106. The rectangle portion of the interface window that defines where the image will actually appear are called  a) Transformation viewing b) View port c) Clipping window d) Screen coordinate system Ans: View port
107. The phenomenon of having a continuous glow of a beam on the screen even after it is removed is called as ?  a) Fluorescence b) Persistence c) Phosphorescence d) Incandescence Ans:  Phosphorescence  
108. Coordinates of window are knows as ..............
 a) Screen coordinates b) World coordinates c) Device coordinates d) Cartesian coordinates Ans: World coordinates
109. Coordinates of  viewport are known as ............  a) World coordinates b)Polar coordinates c) Screen coordinates d)Cartesian coordinates Ans: Screen coordinates
110. The region against which an object is clipped is called a ..............  a) Clip window b) Boundary  c) Enclosing rectangle d) Clip square Ans: Clip window
111. ............. identifies the picture portions that are exterior to the clip window  a) Interior clipping b) Exterior clipping c)Extraction d) None of the above Ans: Exterior clipping
112. Identify line clipping algorithms from the following  a) Cohen- Sutherland algorithm b) Liang-Barsky clipping c) Nicholl-Lee-Nicholl clipping   d)All of the above Ans: All of the above
113. The region code of a point within the window is ............  a) 1111 b)0000  c)1000  d)0001 Ans: 0000
114. According to Cohen-Sutherland algorithm, a line is completely outside the window if ............  a) The region codes of line endpoints have a '1' in same bit position.  b) The endpoints region code are nonzero values  c)  If L bit and R bit are nonzero.  d) The region codes of line endpoints have a '0' in same bit position. Ans: The region codes of line endpoints have a '1' in same bit position.
115. The region code of a point is 1001. The point is in the ................. region of window.  a) Top right  b) Top left c) Bottom left d) Botton right Ans: Top left
116. The result of logical AND operation with endpoint region codes is a nonzero value. Which of the following statement is true?  a) The line is completely inside the window  b) The line is completely outside the window  c) The line is partially inside the window  d) The line is already clipped Ans:  The line is completely outside the window
117. The left (L bit )  bit of the region code of a point (X,Y) is '1' if ......................
 a) X > XWMIN b) X< XWMIN c) X< XWMAX d) X>XWMAX Ans: X< XWMIN
118. The right bit (R bit)of the region code of a point (X,Y) is '1' if ......................  a) X > XWMIN b) X< XWMIN c) X< XWMAX d) X>XWMAX Ans: X>XWMAX
119 . The Most Significant Bit of the region code of a point (X,Y) is '1' if ......................  a) Y > YWMIN b) Y< YWMIN c) Y< YWMAX d) Y>YWMAX Ans: Y>YWMAX
120. The bottom bit of the region code of a point is '0' if .......................  a) Y > YWMIN b) Y< YWMIN c) Y< YWMAX d) Y>YWMAX Ans: Y< YWMIN  
121. The ......................  algorithm divides a 2D space into 9 regions, of which only the middle part (viewport) is visible.  a) Cohen-Sutherland b)Liang Barsky  c) Sutherland Hodegeman d)N-L-N Ans: Cohen-Sutherland
122. A method used to test lines for total clipping is equivalent to the .............  a) logical XOR b) logical OR c)logical AND d) both a & b Ans: logical AND
123. Sutherland Hodgeman algorithm works well for...........  a) Concave polygon  b) Convex polygon d)Smooth curves d) Line segment Ans: Convex polygon
124. A transformation that slants the shape of an object is called ....................  a) Reflection b) Shear c) Distortion d) Scaling Ans: Shear
125. The text clipping strategy to reject an entire character string that overlaps a clip window is called................  a) All-or-none character clipping b) All-or-none string clipping   c) Curve clipping   d) both a & b Ans: All-or-none string clipping
126.  .   The object refers to the 3D representation through linear, circular or some other  representation are called  a) Quadric surface b)       Sweep representation c)       Torus d)       None of these Ans: Sweep representation
127. A quad-tree is a data structure which is used for graphical representation of .....................
 a) 2D digital picture or object b)3D picture or object c) Both a & b d)None of these Ans: 2D digital picture or object
128. A octree is a data structure which is used for alternative representation of ....................  a) 2D digital picture or object c) 3D picture or object c) Both a & b d) None of these Ans: 3D picture or object
129. How many data elements for each region in quad-tree data structure  a) 2 b) 4 c) 8 d)6 Ans: 4
130. How many data elements for each region in octree data structure  a) 2 b) 4 c) 6 d) 8 Ans: 8
131. ............... refer to the shapes created by union, intersection and difference of given shapes  a) .       Wire frame model  b) Composite transformation  c) Constructive solid geometry methods d) None Ans: Constructive solid geometry methods
132. The center of display screen is computed as  a) X max ,y max b) Xmax/2,ymax/2  c) Xmax/3,ymax/3  d) None of these Ans: Xmax/2,ymax/2  
133.  The operation that is used for repositioning the object is called   a) Rubber band method  b) Gravity method c) Dragging d) None Ans: Dragging
134. Which method are used to construct and position the straight lines, arcs and circles etc.  a) Rubber band method  b) Gravity method c) Dragging d)None of these Ans: Rubber band method  
135. Which are used to connect a line to already drawn line  a) Rubber band method  b) Gravity method c) Dragging d)None of these Ans: Gravity field
136. The rubber band method is also applicable to .................... objects.  a) Scale  b) Scalar c) Vector d) Rotate Ans: Scale
137. ............. is known as standard graphics objects  a) Octree b) Quadtree c) Polygon surfaces d) Ellipsoid Ans: Polygon surfaces
 
138. ................. includes vertex coordinates and parameters to identify the spatial orientation of polygon         surfaces  a) Attribute table b) Geometric table c) Orientation table d) Position table Ans:  Geometric table
139. Identify the data structures used to store the data about polygon surfaces  a) Vertex table  b) Polygon table c) Edge table d) All of the above Ans: All of the above
140. Coordinate values for each vertex is stored in ......................  a) Coordinate table b) Vertex table c) Edge table d) Location table Ans: Vertex table  
141. ...................... data structure is used to identify the vertices for each polygon edge.  a) Vertex table  b) Polygon table c) Edge table d)Surface table Ans: Edge table
142.  ...................... data structure is used to identify the edges for each polygon .  a) Vertex table  b) Polygon table c) Edge table d)None of the above Ans: Polygon table
143. A triangular strip connected with 50 triangles connects .................. vertices.  a) 52 b) 48 c) 50 d) 49 Ans: 52
144. When a circle is subjected to translational sweep, a ................. is formed.  a) Ellipse b) Cone  c) Sphere d) Cylinder Ans: Cylinder  
145. A surface of revolution is generated by a .................. of a 2D curve.  a) Translational sweep b) Rotational sweep  c) union d) intersection Ans: Rotational sweep
146. A prism is generated by translational sweep of a ..................  a) Circle b) Square c) Polygon d) Triangle Ans: Polygon
147. The .............. combines the volumes occupied by overlapping 3D objects using set operations  a)Beam penetration b) CSG Method  c)Sweep representation d)None of the above Ans: CSG Method
148. A .................. is a data structure that recursively subdivides a plane into 4 quadrants  a)Octree b)4-way tree c) quadtree d) 4-way mesh Ans: quadtree
 
149.  Identify the methods for Constructive Solid Geometry operations  a) Ray casting b) Ray tracing c) Beam penetraion d) Ray sorting Ans: Ray casting
150. ........................... solid representation take advantage of spatial coherence to reduce the storage representations.  a) Sweep representation  b)Octree c) Polygon surfaces d) CSG Ans: Octree
151. ................... is a data element to store the pixels within an octant having same color  a) Voxel b) Void  c) Tex d) Flag Ans: Voxel
152. Empty regions of the space are represented by type ....................  a) int b) void c) null d) empty Ans: void
153. If all the pixels within an octant have the same color, it is referred to as .....................   a) Heterogeneous octant  b) Homogeneous octant    c) Simultaneous octant  d) Similar octant  Ans: Homogeneous octant  
154. ................... is a label set of output primitives and its associated attributes.  a) Structure b) Function c) Table d) List Ans: Structure
155. ................... enables easy modification to each picture element  a) Structure b) Function c) Table d) List Ans: Structure
156. A structure is created using the function ........................  a) initstructure( ) b) startstructure( ) c) openstructure( ) d) none Ans: openstructure( )
157. ................... is the reference portion value of each structure element.  a) element pointer b) index c)attribute d)attribute index Ans: element pointer
158. Identify the following data structure.  " If a region is uniform, store its properties. If a region is non-uniform, subdivide it and repeat the  process"  a) Octree b) List c) Table d) Polygon surface Ans: Octree
159. Identify the data structures that works on divide and conquer strategy.  a) List b) Table c) Octree d) Pointer Ans: Octree 160. ............... can be produced by interpolating shading patterns across the polygon surfaces to eliminate or reduce the presence of polygon edge boundaries.   a) Rasterizing b) Rendering c) Smoothing d)None Ans: Rendering
161. .......................... function is used to display a structure on the screen.  a) poststructure( ) b) displaystructure( ) c) enablestructure( ) d) structurepost( ) Ans:   poststructure( )
162. All structures can be removed from the screen using the function .....................  a) deletestructure( ) b) unpoststructure( )   c) removestructure( ) d) unposalltstructures( ) Ans: unpostallstructures( )
163. In .............representation, an octree is decomposed into identical cells arranged in a fixed regular grid.   a)cell  b) voxel c) pixel d) array Ans: voxel
164. Identify the odd one out  a) Input mode b) Accept mode c) Sample mode d) Event mode Ans: Accept mode
165. The typical input operation in a general programming language will be in ........ mode  a) Sample b) request c) Event d) Read Ans: request
166. Identify the input mode in which the application program initiates data entry.  a) Sample b) request c) Event d) Read Ans: request
167. In ............... input mode, the input devices initiates data input to the application program.  a) Sample b) request c) Event d) Read Ans: Event
168. The maximum number of devices that can provide input in request mode is ..............  a) 2 b)4 c) Any number of devices d) 1 Ans: 1
169. When an input device is placed in event mode, data input from the device is accumulated in ..................  a)Event queue b)Read queue c)Device list d) None Ans: Event queue
170. The device for specifying a coordinate position (x,y) is known as ..............  a) String device b) Stroke device c) Valuator device d) Locator device Ans: Locator device 171. Which device is suitable to input a series of coordinate positions.  a) Locator b) Stroke c) Valuator d) String Ans: Stroke
172. .................. device is used to specify scalar values.  a) Locator b) Stroke c) Valuator d) String Ans: Valuator  
173. ..................... enables selection of picture components.  a) PICK b) LOCATOR  c) STROKE d) CHOICE Ans: PICK  
174. Choice devices are suitable to select ....................  a) Scalar values b) Menu options c) Text input d) Pictute components Ans: Menu options
175. Identify the string device from the following  a) Mouse b) Webcam c) Keyboard d) Joystick Ans: Keyboard
176. In ................... picture construction, the entity shape and size is dynamically changed with every mouse movement  a) Gravity  b) Rubber band c) Constraint d) Painting Ans: Rubber band
177. ............. technique is employed for drawing entities using mouse only.  a) ) Gravity  b) Rubber band c) Constraint d) Painting Ans: Rubber band
178. ...................... constraint forces the input point to the nearest intersection on a grid.  a) Directional b) Homogeneous c) Modular d)Gravity Ans: Modular
179. .............. is a type of window which is involked by an application when mutiple inputs are required to specify the desired action.  a) Dialog box b) Panel c) Icon  d)Menu Ans: Dialog box
180. Symbolic representation of some object or process is called ................  a) Icons b) Menu c) List d) Label Ans: Icon
181. .................... is used to connect a new line to a previously drawn line.
 a) Gravity field b) Rubberband method c) Paiting d) None Ans: Gravity field
182. Give an example for absolute locator device  a) Mouse b) Touch panel c) Light pen d) None Ans: Touch panel
183. Identify an relative locator device from the following  a) Mouse b) Touch panel c) Light pen d) Keyboard Ans: Mouse
184. Identify the odd one out  a) Icon  b) Slider c) Spin box d) Locator Ans: Locator
185. Which of the following is a 3D graphics package?  a) Paint b) AC3D c) Dreamweaver d) Lightroom Ans: AC3D
186. ................... displays a list of commands  a) Menu b) List c) Icon d) Checkbox Ans: Menu
187. ................ is used to set a value by viewing dynamically the entire data range   a) Menu b) Slider c) Spin boxes d) Text fields Ans: Slider
188. ............... is used to select limited choices of predictable values   a) Menu b) Slider c) Spin boxes d) Text field Ans: Spin boxes
189. The process of calculating the product of matrices of a number of transformations in sequence is called .......................  a) Concatenation b) Continuation c) Mixing d) None Ans: Concatenation
190. The point about which an object is rotated is called ...................  a) Fixed point b) Central point c) Pivot point d) None Ans: Pivot point
191. In ........................ mode the program requests input and suspends processing until input is received.  a) Request b) Event c) Sample d) Constraint Ans: Request
192. Identify odd one out
 a) Vector based  b) Hardware based c) Bitmap based d) Scanline based Ans: Scanline based
193. When the polygon surfaces are to be tiled, ............. is used  a) Polygon net b) Polygon mesh c) Polygon block d) Polygon cell Ans: Polygon mesh
194. ................... is the practice by which an object is drawn by fixing one (or more) points, and then stretching the remain points out, connected by a line or lines that grow and shrink according to various properties.   a) Rubber banding b) Gravity c) Dragging d) grid Ans: Rubber banding
195. ................... is created by revolution of a circle about an axis lying in its plane.  a) Sphere b) Ellipsoid c) Torus d) Cylinder Ans: Torus
196. A region quad tree with depth of 'n' may be used to represent an image having resolution ...............  a) 2n b) 2 x 2n c) 2n x 2n d) 2n Ans: 2n x 2n
197. ........................... is a true tree because the centre of a subdivision always lies on a point.  a) Region quad tree b) Edge quad tree c) Point quad tree d) Child quad tree Ans: Point quad tree
198. ........................ is an adaptation of binary tree representing the 2-D point data  a) Region quad tree b) Edge quad tree c) Point quad tree d) Child quad tree Ans: Point quad tree
199. .................... quad tree stores line rather than point.  a) Region quad tree b) Edge quad tree c) Point quad tree d) Child quad tree Ans: Edge quad tree
200. .................... is commonly used to store sparse data  a) quad tree b) Table c) Binary tree d) Octant Ans: quad tree  
         

Thursday 27 November 2014

Java Transient Keyword

Java transient keyword is used in serialization. If you define any data member as transient, it will not be serialized.

Let's take an example, I have declared a class as Student, it has three data members id, name and age. If you serialize the object, all the values will be serialized but I don't want to serialize one value, e.g. age then we can declare the age data member as transient.

Example of Java Transient Keyword

In this example, we have created the two classes Student and PersistExample. The age data member of the Student class is declared as transient, its value will not be serialized.
If you deserialize the object, you will get the default value for transient variable.
Let's create a class with transient variable.
  1. import java.io.Serializable;  
  2. public class Student implements Serializable{  
  3.  int id;  
  4.  String name;  
  5.  transient int age;//Now it will not be serialized  
  6.  public Student(int id, String name,int age) {  
  7.   this.id = id;  
  8.   this.name = name;  
  9.   this.age=age;  
  10.  }  
  11. }  
Now write the code to serialize the object.
  1. import java.io.*;  
  2. class PersistExample{  
  3.  public static void main(String args[])throws Exception{  
  4.   Student s1 =new Student(211,"ravi",22);//creating object  
  5.   //writing object into file  
  6.   FileOutputStream f=new FileOutputStream("f.txt");  
  7.   ObjectOutputStream out=new ObjectOutputStream(f);  
  8.   out.writeObject(s1);  
  9.   out.flush();  
  10.   
  11.   out.close();  
  12.   f.close();  
  13.   System.out.println("success");  
  14.  }  
  15. }  
Output:
success
Now write the code for deserialization.
  1. import java.io.*;  
  2. class DePersist{  
  3.  public static void main(String args[])throws Exception{  
  4.   ObjectInputStream in=new ObjectInputStream(new FileInputStream("f.txt"));  
  5.   Student s=(Student)in.readObject();  
  6.   System.out.println(s.id+" "+s.name+" "+s.age);  
  7.   in.close();  
  8.  }  
  9. }  
211 ravi 0
As you can see, printing age of the student returns 0 because value of age was not serialized.

Wednesday 26 November 2014

Serialization in Java

Serialization in java is a mechanism of writing the state of an object into a byte stream.
It is mainly used in Hibernate, RMI, JPA, EJB, JMS technologies.
The reverse operation of serialization is called deserialization.
The String class and all the wrapper classes implements java.io.Serializable interface by default.

Advantage of Java Serialization

It is mainly used to travel object's state on the network (known as marshaling).

java.io.Serializable interface

Serializable is a marker interface (has no body). It is just used to "mark" java classes which
support a certain capability.
It must be implemented by the class whose object you want to persist. Let's see the example
given below:
  1. import java.io.Serializable;  
  2. public class Student implements Serializable{  
  3.  int id;  
  4.  String name;  
  5.  public Student(int id, String name) {  
  6.   this.id = id;  
  7.   this.name = name;  
  8.  }  
  9. }  

ObjectOutputStream class

The ObjectOutputStream class is used to write primitive data types and Java objects to an
 OutputStream. Only objects that support the java.io.Serializable interface can be written to streams.

Constructor

1) public ObjectOutputStream(OutputStream out) throws IOException {}creates an ObjectOutputStream that writes to the specified OutputStream.

Important Methods

MethodDescription
1) public final void writeObject(Object obj) throws IOException {}writes the specified object to the ObjectOutputStream.
2) public void flush() throws IOException {}flushes the current output stream.
3) public void close() throws IOException {}closes the current output stream.

Example of Java Serialization

In this example, we are going to serialize the object of Student class. The writeObject() method
of ObjectOutputStream class provides the functionality to serialize the object. We are saving the
state of the object in the file named f.txt.
  1. import java.io.*;  
  2. class Persist{  
  3.  public static void main(String args[])throws Exception{  
  4.   Student s1 =new Student(211,"ravi");  
  5.   
  6.   FileOutputStream fout=new FileOutputStream("f.txt");  
  7.   ObjectOutputStream out=new ObjectOutputStream(fout);  
  8.   
  9.   out.writeObject(s1);  
  10.   out.flush();  
  11.   System.out.println("success");  
  12.  }  
  13. }  
success

Deserialization in java

Deserialization is the process of reconstructing the object from the serialized state.It is the
reverse operation of serialization.

ObjectInputStream class

An ObjectInputStream deserializes objects and primitive data written using an ObjectOutputStream.

Constructor

1) public ObjectInputStream(InputStream in) throws IOException {}creates an ObjectInputStream that reads from the specified InputStream.

Important Methods

MethodDescription
1) public final Object readObject() throws IOException, ClassNotFoundException{}reads an object from the input stream.
2) public void close() throws IOException {}closes ObjectInputStream.

Example of Java Deserialization

  1. import java.io.*;  
  2. class Depersist{  
  3.  public static void main(String args[])throws Exception{  
  4.     
  5.   ObjectInputStream in=new ObjectInputStream(new FileInputStream("f.txt"));  
  6.   Student s=(Student)in.readObject();  
  7.   System.out.println(s.id+" "+s.name);  
  8.   
  9.   in.close();  
  10.  }  
  11. }  
211 ravi

Java Serialization with Inheritance (IS-A Relationship)

If a class implements serializable then all its sub classes will also be serializable.
Let's see the example given below:
  1. import java.io.Serializable;  
  2. class Person implements Serializable{  
  3.  int id;  
  4.  String name;  
  5.  Person(int id, String name) {  
  6.   this.id = id;  
  7.   this.name = name;  
  8.  }  
  9. }  
  1. class Student extends Person{  
  2.  String course;  
  3.  int fee;  
  4.  public Student(int id, String name, String course, int fee) {  
  5.   super(id,name);  
  6.   this.course=course;  
  7.   this.fee=fee;  
  8.  }  
  9. }  
Now you can serialize the Student class object that extends the Person class which is Serializable.
Parent class properties are inherited to subclasses so if parent class is Serializable, subclass would also be.

Java Serialization with Aggregation (HAS-A Relationship)

If a class has a reference of another class, all the references must be Serializable otherwise
serialization process will not be performed. In such case, NotSerializableException is thrown at
runtime.
  1. class Address{  
  2.  String addressLine,city,state;  
  3.  public Address(String addressLine, String city, String state) {  
  4.   this.addressLine=addressLine;  
  5.   this.city=city;  
  6.   this.state=state;  
  7.  }  
  8. }  
  1. import java.io.Serializable;  
  2. public class Student implements Serializable{  
  3.  int id;  
  4.  String name;  
  5.  Address address;//HAS-A  
  6.  public Student(int id, String name) {  
  7.   this.id = id;  
  8.   this.name = name;  
  9.  }  
  10. }  
Since Address is not Serializable, you can not serialize the instance of Student class.

Note: All the objects within an object must be Serializable.


Java Serialization with static data member

If there is any static data member in a class, it will not be serialized because static is the part
of class not object.
  1. class Employee implements Serializable{  
  2.  int id;  
  3.  String name;  
  4.  static String company="SSS IT Pvt Ltd";//it won't be serialized  
  5.  public Student(int id, String name) {  
  6.   this.id = id;  
  7.   this.name = name;  
  8.  }  
  9. }  

Java Serialization with array or collection

Rule: In case of array or collection, all the objects of array or collection must be serializable.
If any object is not serialiizable, serialization will be failed.

Externalizable in java

The Externalizable interface provides the facility of writing the state of an object into a byte
 stream in compress format. It is not a marker interface.
The Externalizable interface provides two methods:
  • public void writeExternal(ObjectOutput out) throws IOException
  • public void readExternal(ObjectInput in) throws IOException

Java Transient Keyword

If you don't want to serialize any data member of a class, you can mark it as transient.