All mock tests are FREE till 31 December — register to save your progress
Paper 2 CS · UNIT 03 · MOCK TEST

Programming Languages and Computer Graphics — Mock Test 8

25 questions · about 30 minutes. Press End Mock any time to see your score and the correct answers.

0 / 25 answered 00:00
Q1.

Of the following, which is NOT a logical error?

Q2.

Which statement is false?

Q3.

What does the following C function f() return?

int f(unsigned int N) {
  unsigned int counter = 0;
  while (N > 0) {
    counter += N & 1;
    N = N >> 1;
  }
  return counter == 1;
}
Q4.

Consider the following recursive Java function:

public static String F(int N) {
  if (N <= 0) return "-";
  return F(N - 3) + N + F(N - 2) + N;
}

The value of F(5) is:

Q5.

Match List I (programming terms) with List II (meaning). List I: A. JNDI, B. RMI, C. JDK, D. JRE. List II: I. Runtime support for running Java programs, II. The API in support of naming and directory services, III. The methods provided by the Java development kit and runtime support for calling remote methods, IV. The compiler and class libraries to develop Java applications.

Q6.

Match List I (programming paradigms) with List II (characteristics). List I: A. Imperative, B. Object-oriented, C. Logic, D. Functional. List II: I. Declarative, clausal representation, theorem proving, II. Side-effect-free, declarative, expression evaluation, III. Imperative, abstract data type, IV. Command-based, procedural.

Q7.

Suppose you have eight black-and-white images taken with a 1-megapixel camera and one 8-colour image taken with an 8-megapixel camera. How much hard disk space in total do you need to store these images?

Q8.

Which of the statements given below are correct? The midpoint (or Bresenham) algorithm for rasterizing lines is optimized relative to DDA algorithm in that

A. it avoids round‐off operations.

B. it is incremental.

C. it uses only integer arithmetic.

D. all straight lines can be displayed as straight (exact).

Q9.

What is the transformation matrix that transforms the square with vertices (1, 1), (−1, 1), (−1, −1), (1, −1) into the parallelogram with corresponding vertices (2, 1), (0, 1), (−2, −1), (0, −1)?

Q10.

A Bezier curve P(t) is defined by four control points P0 = (−2, 0), P1 = (−2, 4), P2 = (2, 4), P3 = (2, 0). Which statements are correct? A. P(t) has degree 3. B. P(1/2) = (0, 3). C. The curve may extend outside the convex hull of its control points.

Q11.

Given below are two statements

Statement I: The maximum number of sides that a triangle might have when clipped to a rectangular viewport is 6.

Statement II: In 3D graphics, the perspective transformation is nonlinear in z. In light of the above statements, choose the correct answer from the options given below

Q12.

With 1-byte chars, 2-byte shorts, 4-byte ints and 8-byte doubles, each aligned to its size, no field reordering, and padding for alignment, how much space does this array use? struct { short s; char c; short t; char d; double r; int i; } A[10];

Q13.

Consider the Java function: public static float f(long m, long n) { float result = (float)m / (float)n; if (m < 0 || n < 0) return 0.0f; else result -= f(m * 2, n * 3); return result; } Which value best approximates f(1, 3)?

Q14.

In the context of 3D Computer graphics, which of the following statements is/are correct?

(A) Under perspective projection, each set of parallel lines in the object do not stay parallel in the image (except those that are parallel to the viewplane to start with).

(B) Applying a perspective transformation in the graphics pipeline to a vertex involves dividing by its ' (z) ' coordinate.

(C) Perspective transformation is a linear transformation.

Q15.

Concerning phong shading and Gouraud shading in a 3D scene, which of the following statements are true?

(A) Gouraud shading requires more computation than phong shading.

(B) Gouraud shading linearly interpolates the color of an interior pixel from the color at the vertices.

(C) Phong shading interpolates over the normal vectors specified at the vertices.

Q16.

Match List-I with List-II. List I gives matrices representing 2D transformations and List-II shows the corresponding transformation diagrams.

Figure
Q17.

Given below are different properties of 3D projections from A-D. Identify the correct order on the basis of property true of (i) a perspective projection only, (ii) an orthographic projection only, (iii) both orthographic and projective transformations and (iv) neither orthographic nor projective transformation, respectively.

(A) Straight lines are mapped to straight lines.

(B) Distances and angles are (in general) preserved.

(C) Far away objects appear the same size as closer ones.

(D) Requires homogeneous coordinates in order for it to be encoded into a linear transformation.

Choose the correct answer from the options given below:

Q18.

Given below are two statements:

Statement I : Bezier curves are curves that interpolate all of their control points.

Statement II : A cubic bezier curve has four control points. In the light of the above statements, choose the correct answer from the options given below

Q19.

What is the output? int i, j, x = 0; for (i = 0; i < 5; ++i) for (j = 0; j < i; ++j) { x += (i + j − 1); break; } printf("%d", x);

Q20.

Let A be the base class in C ++ and B be the derived class from A with protected inheritance. Which of the following statement is false for class B?

Q21.

A rectangle is bounded by x = 0, y = 0, x = 5 and y = 3. The segment joining (−1, 0) and (4, 5), clipped against this window, connects the points

Q22.

Which of the following algorithms is not used for line clipping?

Q23.

1024 × 768 If we want to resize a pixels image to one that is 640 pixels wide with the same aspect ratio, what would be the height of the resized image?

Q24.

Java Virtual Machine (JVM) is used to execute architectural neutral byte code. Which of the following is needed by the JVM for execution of Java Code?

Q25.

Consider the following statements with respect to approaches to fill areas on raster systems : P: To determine the overlap intervals for scan lines that cross the area. Q: To start from a given interior position and paint outward from this point until we encounter the specified boundary conditions. Select the correct answer from the options given below :