Thursday, 28 March 2019

UGC NET CS 2018 July – II Question 10

Question 10
10. Consider the matrix  M=
2 0 0
0 1 0
0 1 1

representing a set of planar (2D) geometric transformations in homogeneous coordinates. Which of the following statements about the matrix M is True ?
  1. (1) M represents first, a scaling of vector (2, 1) followed by
    translation of vector (1, 1)
  2. (2) M represents first, a translation of vector (1, 1) followed by
    scaling of vector (2, 1)
  3. (3) M represents first, a scaling of vector (3, 1) followed by
    shearing of parameters (−1, 1)
  4. (4) M represents first, a shearing of parameters (−1, 1) followed by
    scaling of vector (3, 1)
Answer: (2) M represents first, a translation of vector (1, 1) followed by scaling of vector (2, 1)

PreviousNext
UGC NET CS 2018 July - II Question 9UGC NET CS 2018 July - II Question 11

UGC NET Computer Science July 2018 - II | Question 9

Question 9
9. Which of the following statements is/are True regarding the solution to the visibility problem in 3D graphics ?
S1 : The Painter’s algorithm sorts polygons by depth and then paints (scan - converts) each Polygon on to the screen starting with the most nearest polygon.
S2 : Backface Culling refers to eliminating geometry with backfacing normals.
Code :
  1. (1) S1 only
  2. (2) S2 only
  3. (3) Both S1 and S2
  4. (4) Neither S1 nor S2
Answer : (2) S2 only
  • Statement S1 is False.
    The ‘painter's algorithm’ arranges all the polygons in a view by their depth and then paints them in this order, extreme to closest. It will paint over the existing parts that are usually not visible hence solving the visibility issue at the cost of having painted invisible areas of distant objects.
  • Statement S2 is True
    Backface culling is an important part of how a 3D engine performs visibility checks. Its purpose is to detect polygons that are invisible in a particular scene - that is, polygons that face away from the viewer. Detecting back-facing polygons allows us to eliminate them from an engine's rendering pipeline at an early stage, thus reducing the amount of computation and memory traffic. There are various ways to detect whether a polygon faces towards or away from the viewer, and each method has its own level of complexity and accuracy.
Statement S2 only true statement.

So, Option (2) is correct answer.

Reference : Painter’s Algorithm

Reference 1 : Painter’s Algorithm

Reference 2 : A Compact Method for Backface Culling



PreviousNext
UGC NET CS 2018 July - II Question 8UGC NET CS 2018 July - II Question 10

UGC NET Computer Science July 2018 - II | Question 8

Question 8
A graphic display system has a frame buffer that is 640 pixels wide, 480 pixels high and 1 bit of color depth. If the access time for each pixel on the average is 200 nanoseconds, then the refresh rate of this frame buffer is approximately :
  1. (1) 16 frames per second
  2. (2) 19 frames per second
  3. (3) 21 frames per second
  4. (4) 23 frames per second
Answer : (1) 16 frames per second
Explanation Question 8

Given Values:
Frame buffer width is 640 pixels = horizontal line on screen
Frame buffer height is 480 pixels = vertical line on screen
Color depth is 1 bit

Solution:
Framebuffer is the size of the maximum image that can be displayed.
Screen forms a Matrix of pixels with width of 640 and height of 480.

No of total pixels in the frame buffer = (width  x height)= 640 x 480 px = 307200
Here, color depth is 1 bit.
Memory required by frame buffer = Memory required for total pixel =
Total pixels in the frame buffer x (Color depth) = 307200 x 1

If access time for each pixel on the average is 200 nanoseconds
Time requires to refresh the "whole screen" or "frame buffer" = Memory required by frame buffer x 200 ns = 61440000 nano second = 61440000 x 10−9 second

Then, refresh rate of frame buffer =
number of frame changes per second = 1 / 61440000 x 10−9 second = 100,00,00,000 / 61440000 = 100,000 / 6144 = 16.2760 = 16 (Approximately)

So, Option (1) is correct answer.

What is color depth?
Color depth, also known as bit depth, is either the number of bits used to indicate the color of a single pixel, in a bitmapped image or video framebuffer, or the number of bits used for each color component of a single pixel.
Reference: Color depth

Here Color depth is 1 bit. bit can either depict 0 or 1, i.e., the two colors used for a binary image are black and white. Image with 1 bit color depth is called 1-bit monochrome.

UGC NET Computer Science July 2018 - II | Question 7

Question 7
7. Which of the following statements is/are True ?
P : C programming language has a weak type system with static types.
Q : Java programming language has a strong type system with static types.
Code :
  1. (1) P only
  2. (2) Q only
  3. (3) Both P and Q
  4. (4) Neither P nor Q
Answer : (3) Both P and Q
  • Static Typing
    Essentially, static typing means that variable types are checked at “compile-time”, or before the code is executed.
  • Statement P is True.
    C programming language has a weak type system with static types because it lets you define object types as structures, but it doesn’t do much to enforce or remember them. C automatically convert between many types. C++ and Objective-C go further with the definitions but still don’t enforce the resulting types.
  • Statement Q is True.
    Java programming language has a strong type system with static types because Java forces you to define all types and checks them with a virtual machine.

Example of weak static languages: Weak Static Languages: C, C++ And Objective-C

Find here an example to understand strong static language: Strong Static Languages: Java

Both P and Q statements are true.

So, Option (1) is correct answer.

Reference : Understanding Types; Static vs Dynamic, & Strong vs Weak.


PreviousNext
UGC-NET CS 2018 July - II Question 6UGC NET CS 2018 July - II Question 8

UGC NET Computer Science July 2018 - II | Question 6

Question 6
6. In Java, which of the following statements is/are True ?
S1 : The ‘final’ keyword applied to a class definition prevents the class from being extended through derivation.
S2 : A class can only inherit one class but can implement multiple interfaces.
S3 : Java permits a class to replace the implementation of a method that it has inherited. It is called method overloading.
Code :
  1. (1) S1 and S2 only
  2. (2) S1 and S3 only
  3. (3) S2 and S3 only
  4. (4) All of S1, S2 and S3
Answer : (1) S1 and S2 only
Explanation Question 6

  • Statement S1 is True → Final classes Prevent inheritance. So, final classes cannot be extended or inherited in java.
  • Statement S2 is True → A class can only inherit/extend one class but can implement multiple interfaces.
  • Statement S3 is False → Java permits a class to replace the implementation of a method that it has inherited. It is called method overriding.

Statements S1 and S2 are True statements

So, Option (1) is correct answer.

PreviousNext
UGC-NET CS 2018 July - II Question 5UGC NET CS 2018 July - II Question 7

UGC NET Computer Science July 2018 - II | Question 4

Question 4
4. What is the output of the following ‘C’ program ?
(Assuming little - endian representation of multi-byte data in which Least Significant Byte (LSB) is stored at the lowest memory address.)
#include <stdio.h>
#include <stdlib.h>
/* Assume short int occupies two bytes of storage */
int main ( )
{
         union saving
         {
         short int one;
         char two[2];
         };
         union saving m;
         m.two [0] = 5;
         m.two [1] = 2;
         printf(’’%d, %d, %d\n”, m.two [0], m.two [1], m.one);
}/* end of main */

Options:
  1. (1) 5, 2, 1282
  2. (2) 5, 2, 52
  3. (3) 5, 2, 25
  4. (4) 5, 2, 517
Answer : (4) 5, 2, 517


Explanation Question 4

A union is a special data type available in C that allows to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient way of using the same memory location for multiple-purpose.


PreviousNext
UGC-NET CS 2018 July - II Question 3UGC NET CS 2018 July - II Question 5

UGC NET Computer Science July 2018 - II | Question 5

Question 5
5. Given below are three implementations of the swap( ) function in C++ :
(a) (b) (c)
void swap(int a, int b) {
   int temp;
   temp = a;
   a = b;
   b = temp;
}

int main()
{
  int p = 0, q = 1;
  swap(p, q);
}
void swap(int &a, int &b) {
   int temp;
   temp = a;
   a = b;
   b = temp;
}

int main()
{
 int p = 0, q = 1;
 swap (p, q);
}
void swap(int *a, int *b) {
   int * temp;
   temp = a;
   a = b;
   b = temp;
}

int main()
{
 int p = 0, q = 1;
 swap (&p, &q);
}

Which of these would actually swap the contents of the two integer variables p and q ?
  1. (1) (a) only
  2. (2) (b) only
  3. (3) (c) only
  4. (4) (b) and (c) only
Answer : (2) (b) only
Explanation Question 5

  • Implementation (a) performs the swap on the local variables. So, the original variables are not changed.
  • Implementation (b) swaps the the memory location of a and b (to which they are pointing to) inside swap(), hence p and q also get swapped in main(). Swap() function is accepting the alias of the variable (int &a) - it will evaluate parameter as int &a=p;. To swap values implementation (b) uses pass by reference without pointers.
  • Implementation (c) is incorrect because inside swap function definition there is incorrect assignment of values at the addresses of a and b.

Hence, implementation (b) reflects the swapped value to the passed variable.

So, option (2) is right answer.

Function implementation to swap values using pass by reference without pointer:
void swap(int &n1, int &n2) {
    int temp;
    temp = n1;
    n1 = n2;
    n2 = temp;
}


Function implementation to swap values with pass by reference using pointers:
void swap(int* n1, int* n2) {
    int temp;
    temp = *n1;
    *n1 = *n2;
    *n2 = temp;
}


Reference : Example 1: Passing by reference without pointers


PreviousNext
UGC-NET CS 2018 July - II Question 4UGC NET CS 2018 July - II Question 6

Tuesday, 26 March 2019

UGC NET Computer Science July 2018 - II | Question 3

Question 3
3. What is the output of the following JAVA program ?
class simple
{
     public static void main(String[ ] args)
    {
         simple obj = new simple( );
         obj.start( );
    } 
   void start( ){
         long [ ] P= {3, 4, 5};
         long [ ] Q= method (P);
         System.out.print (P[0] + P[1] + P[2]+”:”);
         System.out.print (Q[0] + Q[1] + Q[2]);
   }
   long [ ] method (long [ ] R)
         {
         R [1]=7;
         return R;
   }
} //end of class

Options:
  1. (1) 12 : 15
  2. (2) 15 : 12
  3. (3) 12 : 12
  4. (4) 15 : 15
Answer : (4) 15 : 15
Explanation Question 3

long [] Q will contains the updated array [3,7,5] returned by the method(P) and the value passed to function as array. So, modification to array reflected to the passed array P.

Actually arrays are passed as reference. So, whatever changes you make in R, it actually gets reflected in P.

Hence both the arrays will display sum=3+7+5=15. So, prints 15:15   

PreviousNext
UGC-NET CS 2018 July - II Question 2UGC NET CS 2018 July - II Question 4

Friday, 22 March 2019

UGC NET Computer Science July 2018 - II | Question 2

Question 2

Consider the JavaScript Code :
  var y = "12" ;
  function f( ) {
      var y = "6" ;
      alert (this.y) ;
      function g( ) { alert (y) ; }
      g( );
  }
  f( );
If M is the number of alert dialog boxes generated by this JavaScript code and D1, D2, ....,DM represents the content displayed in each of the M dialog boxes, then :

Options:
  1. (1) M=3;  D1 displays ”12”;  D2 displays ”6”;  D3 displays ”12”.
  2. (2) M=3;  D1 displays ”6”;  D2 displays ”12”;  D3 displays ”6”.
  3. (3) M=2;  D1 displays ”6”;  D2 displays ”12”.
  4. (4) M=2;  D1 displays ”12”;  D2 displays ”6”.
Answer : (4) M=2; D1 displays ”12”; D2 displays ”6”.

Explanation Question 2

The JavaScript this keyword is used within any function scope or the global scope, and in each scope it receives a different value. The value of this inside a function, effectively depends on the object which called it.

Solved Question-2 NTA UGC NET Computer Science July 2018 - Paper II, Java Script

PreviousNext
UGC NET CS 2018 July - II Question 1UGC NET CS 2018 July - II Question 3

UGC NET Computer Science July 2018 - II | Question 1

Question 1

The definitions in an XML document are said to be __________ when the tagging system and definitions in the DTD are all in compliance.
  1. (1) well-formed
  2. (2) reasonable
  3. (3) valid
  4. (4) logical
Answer : (3) valid

Explanation Question 1

An XML document with correct syntax is called "Well Formed".
An XML document validated against a DTD is both "Well Formed" and "Valid".

XML stands for eXtensible Markup Language.
DTD is a Document Type Definition.

Here is the example of External DTD Declaration for student details.

The XML file definition must contain a reference to the "student.dtd" file:

<?xml version="1.0"?>
<!DOCTYPE student SYSTEM "student.dtd">
<student>
  <firstname>Raj</firstname>
  <lastname>Jani</lastname>
  <mobileno>0123xxxx0123</mobileno>
  <city>Ahmedabad</city>
</student>

Here is the file "student.dtd", which contains the DTD:

<!ELEMENT student (firstname,lastname,mobileno,city)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT mobileno (#PCDATA)>
<!ELEMENT city (#PCDATA)>

PreviousNext
NTA UGC-NET CS 2018 July - Paper IIUGC NET CS 2018 July - II Question 2

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts