Aspire Faculty ID #19240 · Topic: UGC NET Computer Science June 2019 (Paper II) · Just now
UGC NET Computer Science June 2019 (Paper II)

Consider the following C-code fragment running on a $32$-bit x86 machine:

typedef struct {
union {
unsigned char a;
unsigned short b;
} U;
unsigned char c;
} S;

S B[10];
S *p = address of B[4];
S *q = address of B[5];

p->U.b = 0x1234;

If $M$ is the value of $q-p$ and $N$ is the value of address of $(p->c)$ minus address of $p$, then $(M,N)$ is:

Solution

Given that structure $S$ takes $32$ bits.

So,

$32\text{ bits}=4\text{ bytes}$

Now,

$p$ points to $B[4]$

$q$ points to $B[5]$

Since $p$ and $q$ are pointers of type $S$, pointer subtraction gives the difference in number of structures.

So,

$q-p=1$

Therefore,

$M=1$

Now, union $U$ contains $unsigned\ char\ a$ and $unsigned\ short\ b$.

Size of union $U$ is $2$ bytes.

After union $U$, variable $c$ is stored.

So, offset of $c$ from the beginning of structure is $2$ bytes.

Therefore,

$N=2$

Hence,

$(M,N)=(1,2)$

Previous 10 Questions — UGC NET Computer Science June 2019 (Paper II)

Nearest first
1
Consider the following pseudo-code fragment in which an invariant for the loop is $m \times x^k=p^n$ and $k\ge 0$. Pre-…
Topic: UGC NET Computer Science June 2019 (Paper II)
2
Suppose that a computer program takes $100$ seconds of execution time on a computer with multiplication operation respo…
Topic: UGC NET Computer Science June 2019 (Paper II)
3
How many address lines and data lines are required to provide a memory capacity of $16K \times 16$?
Topic: UGC NET Computer Science June 2019 (Paper II)
4
Consider the equation $(146)b+(313){b-2}=(246)_8$ Which of the following is the value of $b$?
Topic: UGC NET Computer Science June 2019 (Paper II)
5
The parallel bus arbitration technique uses an external priority encoder and a decoder. Suppose, a parallel arbiter has…
Topic: UGC NET Computer Science June 2019 (Paper II)
6
For a magnetic disk with concentric circular tracks, the seek latency is not linearly proportional to the seek distance…
Topic: UGC NET Computer Science June 2019 (Paper II)
7
What will be the number of states when a $MOD-2$ counter is followed by a $MOD-5$ counter?
Topic: UGC NET Computer Science June 2019 (Paper II)
8
The fault can be easily diagnosed in the micro-program control unit using diagnostic tools by maintaining the contents …
Topic: UGC NET Computer Science June 2019 (Paper II)
9
How many different Boolean functions of degree $n$ are there?
Topic: UGC NET Computer Science June 2019 (Paper II)
10
Suppose that the register $A$ and the register $K$ have the bit configuration. Only the three leftmost bits of $A$ are …
Topic: UGC NET Computer Science June 2019 (Paper II)

Next 10 Questions — UGC NET Computer Science June 2019 (Paper II)

Ascending by ID
1
What is the output of the following JAVA program? public class Good { private int m; public Good(int m) { this.m = m; }…
Topic: UGC NET Computer Science June 2019 (Paper II)
2
Consider the following C++ function $f()$: unsigned int f(unsigned int n) { unsigned int b = 0; while (n) { b = b + (n …
Topic: UGC NET Computer Science June 2019 (Paper II)
3
Which of the following statements is/are true?$P$: In a scripting language like JavaScript, types are typically associa…
Topic: UGC NET Computer Science June 2019 (Paper II)
4
Which of the following statements is/are true?$P$: An XML document with correct syntax as specified by W3C is called "W…
Topic: UGC NET Computer Science June 2019 (Paper II)
5
Consider a raster system with resolution $640$ by $480$. What size is frame buffer in bytes for this system to store $1…
Topic: UGC NET Computer Science June 2019 (Paper II)
6
Consider the following statements regarding $2D$ transforms in computer graphics: $S1$: [ 1 0 …
Topic: UGC NET Computer Science June 2019 (Paper II)
7
In the context of $3D$ computer graphics, which of the following statements is/are true? $P$: Orthographic transformati…
Topic: UGC NET Computer Science June 2019 (Paper II)
8
Using the Phong reflectance model, the strength of the specular highlight is determined by the angle between:
Topic: UGC NET Computer Science June 2019 (Paper II)
9
Which of the following has same expressive power with regard to relational query language? $(a)$ Relational algebra and…
Topic: UGC NET Computer Science June 2019 (Paper II)
10
With respect to relational algebra, which of the following operations are included for mathematical set theory? $(a)$ J…
Topic: UGC NET Computer Science June 2019 (Paper II)
Ask Your Question or Put Your Review.

loading...