Final
Consider the following code, which key is pressed to make animation faster? window.addEventListener("keydown", function() { switch (event.keyCode) { case 49: direction = !direction; break; case 50: delay /= 2.0; break; case 51: delay *= 2.0; break;} }); '0' '1' '2' '3'
'2'
Suppose that are the three base vector of the three dimensional space. So each vector in this space has a 3-tuple representation with respect to the base. What is the 3-tuple representation of of ? (0, 1, 0) (1, 0, 0) (0, 0, 1) (1, 1, 1)
(0, 1, 0)
Given the following four vertices, which one cannot be on the unit circle? (cosθ,cosθ) (sinθ,-cosθ) (1,1) (sinθ,-sinθ)
(1,1)
Consider perspective projection matrix. For the projection plane at z =−1 and the center of the projection at the origin, the projection matrix is 1 0 0 0 0 1 0 0 0 0 1 0 0 0 w 0 What is the value of w? 1 -0.5 0 -1
-1
What is the expect output for JavaScript express: Math.floor(-6.5); -7 -6.0 -7.0 -6
-7
Consider the following code, what is the frame rate for render function? function render() { setTimeout(function() { requestAnimFrame(render); gl.clear(gl.COLOR_BUFFER_BIT); theta += 0.1; gl.uniform1f(thetaLoc, theta); gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); }, 100); } 25 fps 10 fps 20 fps 15 fps
10 fps
For a color buffer, its k is determined by how many colors the system can display, usually _____________ bits for RGB displays. 16 32 8 24
24
A viewport is a rectangular area of the display window. By default, it is the entire window, but it can be set to any smaller size in pixels via the function gl.viewport. In following function call, what is the width of the viewport? gl.viewport(1, 2, 3, 4); 3 2 1 4
3
For a color buffer, its k is determined by how many colors the system can display, usually _____________ bits for RGBA displays. 24 8 16 32
32
Suppose we have an RGB gifimage logo.gif. Then we can use this image as a texture with the code var myTexels = new Image(); // 1 image.src = "logo.gif"; // 2 gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); // 3 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, myTexels); //4 Which line of code specifies a two-dimensional texture? 1 2 3 4 None
4
Consider the matrix as we may specify by code var m = mat3(1, 2, 3, 4, 5, 6, 7, 8, 9); If we are specifying our matrix in row major order; what is the element in second row, third column? 8 6 4 2
6
Check all features that shall be included in a good program. A variety ofmethods for entering and displaying information Tolerance for user errors A variety of interactive devices on the display Feedback to the user
A variety ofmethods for entering and displaying informatio Tolerance for user errors A variety of interactive devices on the display Feedback to the user
Which of the following is a primary color in full-color system? Black Blue White Yellow
Blue
If we only use ambient and diffuse reflections, we cannot have our images to be shaded and to appear three-dimensional. True or False
False
In imperative programming paradigm, the application sends message to object methods and the object methods do the job accordingly. True or False
False
The basic model of a graphics package is a white box, a term that engineers use to denote a system whose properties are described not only by its inputs and outputs; we may also know everything about its internal workings. True or False
False
To perform the traversal of the tree to draw the figure, we prefer to use depth-first search for tree travesal. True or False
False
Today, virtually all graphics systems are characterized by special-purpose CPU True or False
False
Trees, but not DAGs, are hierarchical methods of expressing the relationships in the physical model. True or False
False
We don't have to provide both a vertex shader and a fragment shader to have a complete application. There are default shaders. True or False
False
Order the modern graphics architecture from higher level to lower level OpenGL High-level API Hardware Virtual Machine
High-level API OpenGL Virtual Machine Hardware
Which of the following are logic input devices? Locator Touchpad String Stroke
Locator String
Which of the following belong to computer graphics system? Memory GPU CPU Framebuffer
Memory GPU CPU Framebuffer
The mapping algorithms can be thought of as either modifying the shading algorithm based on a two-dimensional array, the map, or modifying the shading by using the map to alter the surface using three major techniques: Texture mapping Bump mapping Environment mapping Which of the following is NOT common in these three methods All three alter the shading of indi-vidual fragments as part of fragment processing. All rely on the map being stored as a one-, two-, or three-dimensional digital image. All keep the geometric complexity low while creating the illusion of complex geometry. all are also subject to aliasing errors. None of the above
None of the above
Which of the following is NOT a feature that characterizes three-dimensional objects that fit well with existing graphics hardware and software: The objects are described by their surfaces and can be thought of as being hollow. The objects can be specified through a set ofvertices in three dimensions. None of the above The objects either are composed of or can be approximated by flat, convex polygons.
None of the above
In window coordinates, which of the following is true? Positions are measured in pixels with the origin at the upper-left corner so that positive y values are down. Positions are measured in pixels with the origin at the upper-right corner so that positive y values are up.. Positions are measured in pixels with the origin at the upper-right corner so that positive y values are down. Positions are measured in pixels with the origin at the lower-left corner so that positive y values are up.
Positions are measured in pixels with the origin at the upper-left corner so that positive y values are down.
Suppose that P(x, y), P'(x', y') are points , a, b are real numbers, then x' = ax, y' = by is a ________________________ Rotation Translation Scaling
Scaling
Consider a model of a car with one chassis and four wheels. What the following pseudo code does? Why it is not good? main(){ var s; // speed var d = new Array(3); // direction var t; // time // Determine speed and direction at time t drawRightFrontWheel(s, d); drawLeftFrontWheel(s, d); drawRightRearWheel(s, d); drawLeftRearWheel(s, d); drawChassis(s, d);} The code generating animation of the car; It is not good because it is linear and it shows none of the relationships among the components of the automobile. The code display a still car; It is not good because it is linear and it shows none of the relationships among the components of the automobile. The code display a still car; It is not good because it is inefficient for render. The code generating animation of the car; It is not good because it is inefficient for render.
The code generating animation of the car; It is not good because it is linear and it shows none of the relationships among the components of the automobile.
Consider the following algorithm from your textbook, what is true about this appeoach? function siepinski(){ initialize_the_system(); p=find_initial_point(); for(some_number_of_points){ q=generate_a_point(p); store_the_point(q); p=q; } send_all_points_to_GPU(); display_data_on_GPU(); cleanup(); } 1.)( The strategy used in this algorithm is known as immediate mode graphics 2.) The strategy used in this algorithm is known as retained mode graphics 3.) This one is good to handle the animation
This one is good to handle the animation
What Projection Transformation does? Transfer from Object Coordinates to Clip Coordinates Transfer from Object Coordinate to Camera Coordinates Transfer from Camera Coordinates to Clip Coordinates Transfer from Clip Coordinates to Camera Coordinates
Transfer from Camera Coordinates to Clip Coordinates
A depth buffer is part of the framebuffer. True or False
True
If we start with the left branch, follow it to the left as deep as we can go, then go back up to the first right branch, and proceed recursively. This order of traversal is called a preorder traversal. True or False
True
In C++, if we write a class to represent the vector, we can overload the + operator for this vector class. So, if we declare vector u, v; then u + v will represent a new vector. True or False
True
In a similar manner to buttons and menus, we can create a visual slider element on our web page in the HTML file and handle the input from the events in the JavaScript file. True or False
True
In imperative programming paradigm, the application sends data to functions and the functions send results back to application. True or False
True
In perspective function frustum = function(left, right, bottom, top, near, far); as long as near not equals to far, the resulting matrix is valid. True or False
True
One of the most powerful uses of texture mapping is to provide detail without generating numerous geometric objects. True or False
True
Orthogonal or orthographic projections are a special case of parallel projections, in which the projectors are perpendicular to the view plane. True or False
True
The angle of incidence is the angle between the normal and the light source (assumed to be a point source); the angle of reflection is the angle between the normal and the direction in which the light is reflected. We claim that the angle of incidence is always equal to the angle of reflection. True or False
True
The notion of scene graphs couples nicely with the object-oriented paradigm. True or False
True
The number of bits that are used for each pixel determines properties such as how many colors can be represented on a given system. True or False
True
The only property that a point possesses is that point's location; a mathematical point has neither a size nor a shape. True or False
True
We can look at the projection process as a transformation that takes points(x, y, z) to other points (xp, yp, zp). Although this perspective transformation preserves lines, it is not affine. It is also irreversible. True or False
True
We may implement the modeler and the renderer with different software and hardware. True or False
True
At which of the following, the camera is placed? VUP VRP VPN
VRP
Assume that P, Q, and R are three points that not all on one line. Assume that a, b, c are scales. If T is a point on the same plane with P, Q, R, and located inside the triangle PQR, then we can write T = aP + bQ + cR for some scales a, b, and c. a + b + c = 1. What else condition a, b, and c must satisfy? a, b, and c are all non negatives one of a, b, and c must be negative two of a, b and c must be negative No other restriction on a, b, and c except a + b + c = 1
a, b, and c are all non negatives
In pipeline architecture, the major function of Vertex Processing block is to: change any other attributes of the vertex. compute a color for each vertex. carry out coordinate transformations
carry out coordinate transformations
To implement lighting in the vertex shader, we must carry out three steps. Please order them choose a lighting model. transfer the necessary data to appropriate place write an apporpriate vertex shader
choose a lighting model. write an apporpriate vertex shader transfer the necessary data to appropriate place
Which of the following can be specified by three vertices that are not on the same line ? rectangle circle triangle line segment
circle triangle
We call a face outward facing if the vertices are traversed in a ____________ order when the face is viewed from the outside. This method is also known as the right-hand rule because if you orient the fingers of your right hand in the direction the vertices are traversed, the thumb points outward. counterclockwise clockwise
counterclockwise
What the following code create? var a = vec3(); create a vector as (0, 0 1) create a vector with all three elements 1 create a vector as (1, 0, 0) create a vector with all three elements 0
create a vector with all three elements 0
Consider code: var d = Math.max(dot(normal, lightPostiion), 0.0); Which of the following is true? d will always be non positive d will always be positive d will always be negative d will always be non negative
d will always be non negative
we can set up polygon offset by gl.enable(gl.POLYGON_OFFSET_FILL); gl.polygonOffset(1.0, 2.0); The two parameters in gl.polygonOffset are combined with the slope ofthe polygon and an implementation-dependent constant that guarantees a difference in ______ between the fragments from the polygon and the fragments from the line segments.
depth
Assume we have a button element with id "DirectionButton" in HTML file. Which of the following is equivalent to: var myButton = document.getElementById("DirectionButton"); myButton.addEventListener("click", function() { direction = !direction; } ); ? file.getElementById("DirectionButton").onclick = function() { direction = !direction; }; document.getElementById("DirectionButton").onclick = function() { direction = !direction; }; document.getElementByName("DirectionButton").onclick = function() { direction = !direction; }; file.getElementByName("DirectionButton").onclick = function() { direction = !direction; };
document.getElementById("DirectionButton").onclick = function() { direction = !direction; };
Which of the following could be a symbol in an non-hierarchical approach in computer graphics programming? fonts geometric objects application-specific sets of graphical objects
fonts geometric objects application-specific sets of graphical objects
We can separate primitives into two classes: ________________ primitives and image,or raster, primitives. G
geometric
Which of the following will bind a texture object named texture as the current two-dimensional texture object ? gl.bindTexture(TEXTURE_2D, texture); gl.bindTexture(gl.TEXTURE_2D, texture); gl.bind(gl.TEXTURE_2D, texture); gl.bind(TEXTURE_2D, texture);
gl.bindTexture(gl.TEXTURE_2D, texture);
Select code that will be put into a simple render function that will display a sequence of triangles. gl.drawArrays(gl.POINTS, 0, numPoints); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.TRIANGLES, 0, numVertices); points.push(a); gl.drawArrays(gl.LINES, 0, numVertices)
gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.TRIANGLES, 0, numVertices);
Which of the following code segment will make the window solid and red? gl.clearColor(1.0, 0.0, 0.0, 1.0);g1.clear(gl.COLOR_BUFFER_BIT); gl.clearColor(0.0, 0.0, 0.0, 1.0);g1.clear(gl.COLOR_BUFFER_BIT); gl.clearColor(0.0, 0.0, 0.0, 0.0);g1.clear(gl.COLOR_BUFFER_BIT); gl.clearColor(0.0, 0.0, 1.0, 1.0);g1.clear(gl.COLOR_BUFFER_BIT); gl.clearColor(0.0, 1.0, 0.0, 1.0);g1.clear(gl.COLOR_BUFFER_BIT);
gl.clearColor(1.0, 0.0, 0.0, 1.0);g1.clear(gl.COLOR_BUFFER_BIT);
For a convex object, such as the cube, faces whose normals point away from the viewer are never visible and can be eliminated or culled before the rasterizer. We can turn on culling in WebGL by enabling it as follows: gl.enable(gl.CULL_FACE); Suppose that we want to cull front face, we will use __________________ gl.cullFace(FRONT); You cannot cull the front face gl.cullFace(gl.FRONT); gl.cull(FRONT);
gl.cullFace(gl.FRONT);
Suppose we write a computer graphic program to animate a robot, whose parts are torso, head, left upper arm, left lower arm, right upper ar,m, right lower arm, left upper leg, left lower leg, right upper leg, and right lower leg. From the following render function, what you can conclude for sure? function render() { gl.clear(gl.COLOR_BUFFER_BIT); traverse(headId); requestAnimFrame(render); } it uses preoder travesal it uses breadth first search for travesal torso is the root of the tree head is the root of the tree
head is the root of the tree
Consider the following function, which add triangle vertex positions into a vertex array, what shall be in the blank? function triangle(a, b, c){ pointsArray.push(a); pointsArray.push(a); pointsArray.push(a); _______________} index += 3; index += 1; index = 3; index += 4;
index += 3;
Suppose that we use only two colors in a vertex shader: vec4 color1 = vec4(1.0, 1.0, 0.0, 1.0); // yellow vec4 color2 = vec4(1.0, 0.0, 0.0, 1.0); // red We could then switch between the colors based, for example, on the magnitude ofthe diffuse color. Using the light and normal vectors, we could assign colors as gl_FragColor = (dot(lightv, norm)) > 0.5 ? color1 : color2); Which of the following will assign yellow to gl_FragColor? lighty = (0, 1, 0) and norm = (0, 1, 0); none of these lighty = (0, 0, 1) and norm = (0, 1, 0) lighty = (1, 0, 0) and norm = (0, 1, 0)
lighty = (0, 1, 0) and norm = (0, 1, 0);
In following JavaScript code, what is the value of x? var p = [1, 2, 3, 4]; // line 1 var n = p.length; // line 2 var x = p[4] + n; // line 3 line 3 has error line 1 has error 8 line 2 has error
line 3 has error
When we map texture coordinates to the array of texels, we rarely get a point that corresponds to the center of a texel. One option is to use a weighted average of a group of texels in the neighborhood of the texel determined by point sampling. This option is known as __________ filtering.
linear
In most applications, we tend to specify or use an object with a convenient size, orientation, and location in its own frame, called the ________ frame. For example, a cube would typically have its faces aligned with axes of the frame, its center at the origin, and a side length of1 or 2 units. world model eye object
model
Which of the following code using the instance matrix to alter the current model-view matrix? instanceMatrix = add(modelViewMatrix, instanceMatrix); instanceMatrix = mult(modelViewMatrix, instanceMatrix); modelViewMatrix = add(modelViewMatrix, instanceMatrix); modelViewMatrix = mult(modelViewMatrix, instanceMatrix);
modelViewMatrix = mult(modelViewMatrix, instanceMatrix);
The function's name shall be readable . In API of a pen-plotter model, which of the following will move the pen to location (x, y) ? moveto(x, y) lineto(x, y)
moveto(x, y)
Consider the following code for a RBG image. var texSize = 512; var myImage = new Uint8Array(3*texSize*texSize); In this case, to reference the pixel at row i, column j, we would use _________________. myImage[3*texSize*i + 3*j]; myImage [texSize*i+j], myImage[i][j] myImage [3*texSize*i+j]
myImage [texSize*i+j],
Consider the Robot Arm example in your textbook. We alter the model-view matrix incrementally to display the various parts of the model efficiently. fuunction render() { gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); modelViewMatrix = rotate(theta[a[Base], 0, 1, 0); // 1. What code put here modelViewMatrix = mult(modelViewMatrix, translate(0.0, BASE_HEIGHT, 0.0)); modelViewMatrix = mult(modelViewMatrix, rotate(theta[LowerArm], 0, 0, 1)); // 2. What code put here modelViewMatrix = mult(modelViewMatrix, translate(0.0, LOWER_ARM_HEIGHT, 0.0)); modelViewMatrix = mult(modelViewMatrix, rotate(theta[UpperArm], 0, 0, 1)); // 3. what code put here requestAnimFrame(render); // 4. what code put here} what code put at location with line number // 4. no code needed display lower arm display upper arm display base
no code needed
In all orthographic (or orthogonal) views, the projectors are ________ to the projection plane. In a multi-view orthographic projection, we make multiple projections, in each case with the projection plane _______ to one of the principal faces of the object. perpendicular, perpendicular perpendicular, parallel parallel, parallel parallel, perpendicular
perpendicular, parallel
Which of the following may be the target for onclick event? canvas physical mouse screen a button on the display that was created as part of our HTML document.
physical mouse a button on the display that was created as part of our HTML document.
Which of the following approach of computer graphics architecture can achieve real time behavior? ray tracing radiosity photon mapping pipeline
pipeline
Suppose that n is normal to the surface, p0 is a point on the surface, p is any point on the surface. If the equation holds, then the surface is a ________ sphere plane any surface any smooth surface
plane
Which object is defined by an order list of vertices? (Choose best answer) circle line polygon triangle
polygon
Consider the following code function traverse(id) { if (id == null) return; mvStack.push(modelViewMatrix); modelViewMatrix = mult(modelViewMatrix, figure[id].transform); figure[id].render(); if (figure[id].child != null) { traverse(figure[id].child); }modelViewMatrix = mvStack.pop(); if (figure[id].sibling != null) { traverse(figure[id].sibling); } } This is a left child right sibling structure. What is its travesal? preorder postorder Inorder
preorder
A ________________ variable provides access to a texture object, including all its parameters. sampler array color texture
sampler
Which of the following call render function most times in one second? setInterval(render); setInterval(render, 0); setInterval(render, 100); setInterval(render, 1);
setInterval(render, 0);
Mirrors are perfectly __________ surfaces; specular diffuse translucent non of these
specular
If u and v are any unit-length vectors, we can compute the cosine of the angle θ between them with the dot productcos θ = u . v, a calculation that requires only __________. three multiplications and three additions. three multiplications and two additions. two multiplications and three additions. two multiplications and two additions.
three multiplications and two additions.
Consider three vectors, l, n, and v, which are direction of in ray, normal of the surface, and out ray, respectively. If the viewer is distant (i.e. at infinite), which of the following is constant? l n v none of these three
v
Which of the following create a texture object? var texture = gl.texture(); var texture = gl.createTexture(); var texture = gl.getTexture(); var texture = gl.setTexture();
var texture = gl.createTexture();
WebGL programs specify primitives through lists of ____________.
vertices
Consider the following code var texSize = 512; myImage = new Array(texSize); for (var i = 0; i < texSize; ++i) { myimage[i] = new Array(texSize); for (var j = 0; j < texSize; ++j) { myImage[i][j] = new Uint8Array(3); // *******} } If we change the line with // ***** to myImage[i][j] = new Float32Array(1); what happen? we are using a floating-point representation none of these we are working with monochromatic or luminance images Syntax error
we are using a floating-point representation
Points on the cylinder are given by the parametric equations. Which equation is missing? x = r cos(2πu) z = v/h y = r cos(2πu) y = r sin(πu) y = r cos(πu) y = r sin(2πu)
y = r sin(2πu)