You are on page 1of 207

GATE NoteBook

Target JRF - UGC NET Computer Science Paper 2

1000 MEQs
100 Qs on Programming
Languages & Computer Graphics
Most Expected Questions Course
1
1
2
2
C is correct Answer *someFun suffers no problem and
gives the output correctly because the character
constants are stored in code/data area and not
allocated in stack, so this doesn’t lead to dangling
pointers.
*somefun1 functions suffer from the problem of
dangling pointers. In someFun1() temp is a character
array and so the space for it is allocated in heap and is
initialized with character string “Monday Tomorrow”.
This is created dynamically as the function is called, so is
also deleted dynamically on exiting the function so the
string data is not available in the calling function main()
leading to print some garbage values.
3
3
4
4

Correct Answer : C Compiler error: Lvalue required in


function main .Array names are pointer constants. So it
cannot be modified.
names is a 2d array and if you mention less than this 2
dimension it will some address , so here names[3] will be a
address and you cant assign value to a constant address.
on left side it should be a variable name.
5
5

Code 1:- Answer a) :Since


the #define replaces the string
int by the macro char.

Code 2: Answer a) :The macro


call square(4) will substituted by
4*4 so the expression becomes i
= 64/4*4 . Since / and * has
equal priority the expression will
be evaluated as (64/4)*4 i.e.
16*4 = 64. Correct Answer: a,a.
6
6

B
7
7

p is pointing to character '\n'. str1 is pointing to character


'a' ++*p. "p is pointing to '\n' and that is incremented by
one." the ASCII value of '\n' is 10, which is then
incremented to 11. The value of ++*p is 11. ++*str1, str1 is
pointing to 'a' that is incremented by 1 and it becomes 'b'.
ASCII value of 'b' is 98.
Now performing (11 + 98 – 32), we get 77 (77 is the ASCII
value for "M");
So we get the output 77.
8
8
Correct Answer :- C
*str is a array pointer of string, **sptr is array
pointer(double pointer) that is pointing to str
strings in reverse order. ***pp also a pointer
that is pointing sptr base address.
++pp will point to 1st index of sptr that
contain str+2 ("33333").In
printf("%s",**++pp+2); ++pp will point to
str+1, and **++pp, value stored @str+1
("22222”).
and (**++pp)+2 will point the 2nd index of
"22222", hence 222 will print.
9
9

D (Compilation error) should be


correct answer.

Some compiler will give C as a


answer but as per standard we
can not apply arithmetic
operation on void pointer.
10
10

Correct answer is 6+8=14 ,size of array


will be (6*4)/4=6 and second printf will
print 8 as given it is 64 bit machine so
size of pointer will be 8 byte.
Sum=6+8=14.(It give warning as no of
element is more than size but not
error ).
11
11
Correct Answer D: In this example,
&x[2], the address of the third element,
is assigned to the ptr pointer.

Hence, 3 was displayed when we


printed *ptr. And, printing *(ptr+1)
gives us the fourth element 4. Similarly,
printing *(ptr-2) gives us the First
element 1.
12
12
Correct Answer is C, because in switch case
(x++ | |++y ) or condition is there and when
(left side) x++ is true it will not evaluate right
side (true mean non zero value in c) here or is
Logical Operator and return 1 here. so the
output will Hi 11 5.
13
13
14
14
B is correct answer ,it will skip first 5 character including
blank space and then print:-2022 CS/IT
15
15

ANSWER A

Explanation:
Initially pointer c is assigned to both p and q. In the first
loop, since only q is incremented and not c ,
the value 1 will be printed 5 times. In second loop p itself
is incremented. So the values 1 2 4 6 5 will be printed
What will be the output of 16
following program?
#include <stdio.h>
int main()
{
int a = 5, *b, c;
b = &a;
printf("%d", a * *b * a + *b);
return (0);
}
What will be the output of 16
following program?
#include <stdio.h>
int main()
{
int a = 5, *b, c;
b = &a;
printf("%d", a * *b * a + *b);
return (0);
}

ANS : 130
Predict the output of following program. Assume that the characters are represented using ASCII Values.

#include <stdio.h>
#define VAL 32 17
int main()
{
char arr[] = "geeksquiz";
*(arr + 0) &= ~VAL;
*(arr + 5) &= ~VAL;
printf("%s", arr);

return 0;
}
(A) GeeksQuiz
(B) geeksQuiz
(C) Geeksquiz
(D) geeksquiz
(E) Garbage eeks Garbage uiz
Predict the output of following program. Assume that the characters are represented using ASCII Values.

#include <stdio.h>
#define VAL 32

int main()
17
{
char arr[] = "geeksquiz";
*(arr + 0) &= ~VAL;
*(arr + 5) &= ~VAL;
printf("%s", arr);

return 0;
}
(A) GeeksQuiz
(B) geeksQuiz
(C) Geeksquiz
(D) geeksquiz
(E) Garbage eeks Garbage uiz

Answer: (A)

Explanation: The crux of the question lies in the statement: *(arr + 5) &= ~VAL;
This statement subtracts 32 from the ascii value of a lower case character and thus converts it to upper case. This is another way to convert an alphabet to
upper case by resetting its bit positioned at value 32 i.e. 5th bit from the LSB(assuming LSB bit at position 0).
Choose the correct option 18
#include<stdio.h>
main()
{
register int x = 9;
int *p;
p=&x;
x++;
printf("%d",*p);
}
1. Garbage value
2. 9
3. 10
4. Compile error
Choose the correct option 18
#include<stdio.h>
main()
{
register int x = 9;
int *p;
p=&x;
x++;
printf("%d",*p);
}
1. Garbage value
2. 9
3. 10
4. Compile error
which option is correct?

#include <iostream>
19
using namespace std;
int main()
{
int x = y = z = 20;
x = y = z = 40;
printf("%d %d %d", x, y, z);
return 0;
}
Option
a) 20 20 20
b) Compile Time Error
c) Three Garbage Value
d) 40 40 40
which option is correct?

#include <iostream>
19
using namespace std;
int main()
{
int x = y = z = 20;
x = y = z = 40;
printf("%d %d %d", x, y, z);
return 0;
}
Option
a) 20 20 20
b) Compile Time Error (Y undeclared)
c) Three Garbage Value
d) 40 40 40
Guess the output! 20
int main()
{
int arr[10];
printf("%d",*arr+1-*arr+3);
return 0;
}
Guess the output! 20
int main()
{
int arr[10];
printf("%d",*arr+1-*arr+3);
return 0;
}
arr is an array which is not initialized. If we use arr, then it will point to the first element of the array.
Therefore *arr will be the first element of the array. Suppose first element of array is x, then the
argument inside printf
becomes as follows. It’s effective value is 4.
x+1–x+3=4
#include<stdio.h> 21
int main()
{
int k, num=30;
k = (num>5 ? (num <=10 ? 100 : 200): 500);
printf("%d\n", num);
return 0;
}
#include<stdio.h> 21
int main()
{
int k, num=30;
k = (num>5 ? (num <=10 ? 100 : 200): 500);
printf("%d\n", num);
return 0;
}

ANSWER : 30
Among the following, which shows the Multiple inheritances? 22
A. X,Y->Z
B. X->Y->Z
C. X->Y;X->Z
D. None of the above
Among the following, which shows the Multiple inheritances? 22
A. X,Y->Z
B. X->Y->Z
C. X->Y;X->Z
D. None of the above
Answer: A

Explanation: In multiple inheritances, a single class can inherit properties


form more than one base class.
Which of the following statements is correct about the friend function in C++ programming language?

A. A friend function is able to access private members of a class


23
B. A friend function can access the private members of a class
C. A friend function is able to access the public members of a class
D. All of the above
Which of the following statements is correct about the friend function in C++ programming language?

A. A friend function is able to access private members of a class


23
B. A friend function can access the private members of a class
C. A friend function is able to access the public members of a class
D. All of the above

Answer: D

Explanation: A friend function can access any member of a class without caring about the type of member it
contains, such as public, private, and protected.
Which one of the following cannot be a friend in C++ languages?

A.
B.
A Class
A Function
24
C. An Object
D. None of the above
Which one of the following cannot be a friend in C++ languages?

A.
B.
A Class
A Function
24
C. An Object
D. None of the above

Answer: C

Explanation: In general, an object of any class cannot be a friend of the same and any other class as well.
However, there are some functions, operator, and classes which can be made a friend.
Which type of approach is used by the C++ language?

A. Right to left
25
B. Left to right
C. Top to bottom
D. Bottom-up
Which type of approach is used by the C++ language?

A. Right to left
25
B. Left to right
C. Top to bottom
D. Bottom-up

Answer: D

Explanation: Generally, C++ uses the Bottom-up approach while other programming languages like C use the top-
down approach.
26
Which one of the following statements about the pre-increment is true?

1.Pre Increment is usually faster than the post-increment


2.Post-increment is faster than the pre-Increment
3.Pre increment is slower than post-increment
4.pre decrement is slower than post-increment
Which one of the following statements about the pre-increment is true? 26
1.Pre Increment is usually faster than the post-increment
2.Post-increment is faster than the pre-Increment
3.Pre increment is slower than post-increment
4.pre decrement is slower than post-increment

Answer: a
Description: Pre Increment is usually faster than the post-increment because it
takes one-byte instruction whereas the post-increment takes two-byte instruction.
class Derived
{
public void getDetails(String temp)
{
System.out.println("Derived class " + temp);
27
}
}

public class Test extends Derived


{
public int getDetails(String temp)
{
System.out.println("Test class " + temp);
return 0;
}
public static void main(String[] args)
{
Test obj = new Test();
obj.getDetails("GFG");
}
}
a) Derived class GFG
b) Test class GFG
c) Compilation error
d) Runtime error
class Derived
{
public void getDetails(String temp)
{
System.out.println("Derived class " + temp);
27
}
}

public class Test extends Derived


{
public int getDetails(String temp)
{
System.out.println("Test class " + temp);
return 0;
}
public static void main(String[] args)
{
Test obj = new Test();
obj.getDetails("GFG");
}
}
a) Derived class GFG
b) Test class GFG
c) Compilation error
d) Runtime error

Ans. (c)
Explanation: The overriding method must have same signature, which includes, the argument list and the return type.
What is the output of the following program?

class Derived
{
28
protected final void getDetails()
{
System.out.println("Derived class");
}
}

public class Test extends Derived


{
protected final void getDetails()
{
System.out.println("Test class");
}
public static void main(String[] args)
{
Derived obj = new Derived();
obj.getDetails();
}
}
a) Derived class
b) Test class
c) Runtime error
d) Compilation error
What is the output of the following program?

class Derived
{
protected final void getDetails()
28
{
System.out.println("Derived class");
}
}

public class Test extends Derived


{
protected final void getDetails()
{
System.out.println("Test class");
}
public static void main(String[] args)
{
Derived obj = new Derived();
obj.getDetails();
}
}
a) Derived class
b) Test class
c) Runtime error
d) Compilation error

Ans. (d)
Explanation: Final and static methods cannot be overridden.
What is the output of the following program?

class Derived
{
29
public void getDetails()
{
System.out.println("Derived class");
}
}

public class Test extends Derived


{
protected void getDetails()
{
System.out.println("Test class");
}
public static void main(String[] args)
{
Derived obj = new Test(); // line xyz
obj.getDetails();
}
}
a) Test class
b) Compilation error due to line xyz
c) Derived class
d) Compilation error due to access modifier
What is the output of the following program?

class Derived
{
29
public void getDetails()
{
System.out.println("Derived class");
}
}

public class Test extends Derived


{
protected void getDetails()
{
System.out.println("Test class");
}
public static void main(String[] args)
{
Derived obj = new Test(); // line xyz
obj.getDetails();
}
}
a) Test class
b) Compilation error due to line xyz
c) Derived class
d) Compilation error due to access modifier

Ans: (d)
Explanation: The overriding method can not have more restrictive access modifier.
What is the output of the following program?

import java.io.IOException;

class Derived
30
{
public void getDetails() throws IOException //line 23
{
System.out.println("Derived class");
}
}

public class Test extends Derived


{
public void getDetails() throws Exception //line 24
{
System.out.println("Test class");
}
public static void main(String[] args) throws IOException //line 25
{
Derived obj = new Test();
obj.getDetails();
}
}
a) Compilation error due to line 23
b) Compilation error due to line 24
c) Compilation error due to line 25
d) All the above
What is the output of the following program?

import java.io.IOException;

class Derived
{
30
public void getDetails() throws IOException //line 23
{
System.out.println("Derived class");
}
}

public class Test extends Derived


{
public void getDetails() throws Exception //line 24
{
System.out.println("Test class");
}
public static void main(String[] args) throws IOException //line 25
{
Derived obj = new Test();
obj.getDetails();
}
}
a) Compilation error due to line 23
b) Compilation error due to line 24
c) Compilation error due to line 25
d) All the above

Ans. (b)
Explanation: The exception thrown by the overriding method should not be new or more broader checked exception. In the code above, Exception is more broader class of checked
exception than IOException, so this results in compilation error.
class GfG
{
public static void main(String args[])
31
{
try
{
System.out.println("First statement of try block");
int num=45/3;
System.out.println(num);
}
catch(Exception e)
{
System.out.println("Gfg caught Exception");
}
finally
{
System.out.println("finally block");
}
System.out.println("Main method");
}
}
class GfG
{
public static void main(String args[])
{
try
{
31
System.out.println("First statement of try block");
int num=45/3;
System.out.println(num);
}
catch(Exception e)
{
System.out.println("Gfg caught Exception");
}
finally
{
System.out.println("finally block");
}
System.out.println("Main method");
}
}
Output:

First statement of try block


15
finally block
Main method
Explanation:
Since there is no exception, the catch block is not called, but the finally block is always executed after a try block
whether the exception is handled or not.
What does the following fragment of C-program print?
32
char c[] = "GEEK2018";
char *p =c;
printf("%c,%c", *p,*(p+p[3]-p[1]));
(A) G, 1
(B) G, K
(C) GEEK2018
(D) None of the above
Que – 1. What does the following fragment of C-program
print?
32
char c[] = "GEEK2018";
char *p =c;
printf("%c,%c", *p,*(p+p[3]-p[1]));
As p is a pointer of type character, *p will print ‘G’
(A) G, 1
Using pointer arithmetic,
(B) G, K
*(p+p[3]-p[1]) = *(p+75-69) (Using ascii values of K and E) = *(p+6) = 1
(C) GEEK2018
(as we know p is holding the address of base string means 0th
(D) None of the above
position string, let assume the address of string starts with 2000 so
p+6 means the address of p(we are adding 6 in 2000 that means 2006,
and in 2006 the “1”is stored that is why answer is 1).
Therefore, the output will be G, 1.
Que – 2. Which of the following C code snippet is not valid? 33
(A) char* p = “string1”; printf(“%c”, *++p);
(B) char q[] = “string1”; printf(“%c”, *++q);
(C) char* r = “string1”; printf(“%c”, r[1]);
(D) None of the above
Que – 2. Which of the following C code snippet is not valid? 33
(A) char* p = “string1”; printf(“%c”, *++p);
(B) char q[] = “string1”; printf(“%c”, *++q);
(C) char* r = “string1”; printf(“%c”, r[1]);
(D) None of the above

Solution: Option (A) is valid as p is a pointer pointing to character ‘s’ of “string1”. Using ++p, p will point to
character ‘t’ in “string1”. Therefore, *++p will print ‘t’.
Option (B) is invalid as q being base address of character array, ++q(increasing base address) is invalid.
Option (C) is valid as r is a pointer pointing to character ‘s’ of “string1”. Therefore,

r[1] = *(r+1) = ‘t’ and it will print ‘t’.


Find the output of the C program below , assume base address of the
array is 1000 and size of int as 4 bytes.

main() 34
{
Unsigned int a[2][3] = {{30,20,10}, {16,15,14}} ;
printf(“%u%u%u\n” , a, a+1 , &a, &a+1);
}

1. 1000,1012,1000,1024
2. 1000,1012,1008,1024
3. 1000,1012,1000,1012
4. 1000,1012,1012,1024
Find the output of the C program below , assume base address of the
array is 1000 and size of int as 4 bytes.

main()
{
34
Unsigned int a[2][3] = {{30,20,10}, {16,15,14}} ;
printf(“%u%u%u\n” , a, a+1 , &a, &a+1);
}

The base address(also the address of the first element) of array is 1000.

Therefore, a+1 is pointing to the memory location of first element of the second row in array a.
Hence 1000 + (3 ints * 4 bytes) = 1012

Hence, begining address 1000 + 24 = 1024. So, &a+1 = 1024


Hence the output of the program is 1000,1012,1000,1024
Which of the following is correct way to define the
function fun() in the below program?
35
#include<stdio.h> C.
void fun(int *p[][4])
int main() {
{ }
int a[3][4]; D.
fun(a); void fun(int *p[3][4])
{
return 0;
}
}
A.
void fun(int p[][4])
{
}
B.
void fun(int *p[4])
{
}
Which of the following is correct way to define the
function fun() in the below program?
35
#include<stdio.h> C.
void fun(int *p[][4])
int main() {
{ }
int a[3][4]; D.
fun(a); void fun(int *p[3][4])
{
return 0;
}
} Answer: Option A
A.
void fun(int p[][4]) Explanation:
{
} void fun(int p[][4]){ } is the correct way to write the function
B. fun(). while the others are considered only the function fun() is
void fun(int *p[4]) called by using call by reference.
{
}
What will be the output of the program ?

#include<stdio.h>
36
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
A. 2, 1, 15
B. 1, 2, 5
C. 3, 2, 15
D. 2, 3, 20
Answer: Option C
What will be the output of the program ?

#include<stdio.h>
Explanation: 36
Step 1: int a[5] = {5, 1, 15, 20, 25}; The variable arr is declared
int main() as an integer array with a size of 5 and it is initialized to
{
int a[5] = {5, 1, 15, 20, 25}; a[0] = 5, a[1] = 1, a[2] = 15, a[3] = 20, a[4] = 25 .
int i, j, m;
i = ++a[1]; Step 2: int i, j, m; The variable i,j,m are declared as an integer
j = a[1]++; type.
m = a[i++];
printf("%d, %d, %d", i, j, m); Step 3: i = ++a[1]; becomes i = ++1; Hence i = 2 and a[1] = 2
return 0;
} Step 4: j = a[1]++; becomes j = 2++; Hence j = 2 and a[1] = 3.
A. 2, 1, 15
B. 1, 2, 5 Step 5: m = a[i++]; becomes m = a[2]; Hence m = 15 and i is
C. 3, 2, 15 incremented by 1(i++ means 2++ so i=3)
D. 2, 3, 20
Step 6: printf("%d, %d, %d", i, j, m); It prints the value of the
variables i, j, m

Hence the output of the program is 3, 2, 15


What will be the output of the program ?

A.1, 1, 1, 1
37
#include<stdio.h>
2, 3, 2, 3
3, 2, 3, 2
int main()
4, 4, 4, 4
{
static int a[2][2] = {1, 2, 3, 4}; B.1, 2, 1, 2
int i, j; 2, 3, 2, 3
static int *p[] = {(int*)a, (int*)a+1, (int*)a+2}; 3, 4, 3, 4
for(i=0; i<2; i++) 4, 2, 4, 2
{
for(j=0; j<2; j++) C.1, 1, 1, 1
{ 2, 2, 2, 2
2, 2, 2, 2
printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i),
3, 3, 3, 3
*(*(i+p)+j), *(*(p+j)+i));
} D.1, 2, 3, 4
} 2, 3, 4, 1
return 0; 3, 4, 1, 2
} 4, 1, 2, 3
What will be the output of the program ?

A.1, 1, 1, 1
37
#include<stdio.h>
2, 3, 2, 3
3, 2, 3, 2
int main()
4, 4, 4, 4
{
static int a[2][2] = {1, 2, 3, 4}; B.1, 2, 1, 2
int i, j; 2, 3, 2, 3
static int *p[] = {(int*)a, (int*)a+1, (int*)a+2}; 3, 4, 3, 4
for(i=0; i<2; i++) 4, 2, 4, 2
{
for(j=0; j<2; j++) C.1, 1, 1, 1
{ 2, 2, 2, 2
2, 2, 2, 2
printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i),
3, 3, 3, 3
*(*(i+p)+j), *(*(p+j)+i));
} D.1, 2, 3, 4
} 2, 3, 4, 1
return 0; 3, 4, 1, 2
} 4, 1, 2, 3
What will be the output of the following program?

abstract class MyFirstClass


{
38
abstract num (int a, int b) { }
}

A. No error
B. Method is not defined properly
C. Constructor is not defined properly
D. Extra parentheses
What will be the output of the following program?

abstract class MyFirstClass


{
38
abstract num (int a, int b) { }
}
A. No error
B. Method is not defined properly
C. Constructor is not defined properly
D. Extra parentheses

Answer: (b) Method is not defined properly.

Explanation: Following are some rules for declaring an abstract method:

Abstract methods do not specify a method body, but they only have a method signature.
Abstract methods are always defined inside an abstract class.
In the above code, MyFirstClass is an abstract class. It contains an abstract method named num() that is not defined
properly. According to the rules discussed above, an abstract method only has a method signature, not the method
body.

Hence, the correct answer option (b).


Which of the following is a mutable class in java?
1.java.lang.String
39
2.java.lang.Byte
3.java.lang.Short
4.java.lang.StringBuilder
Which of the following is a mutable class in java?
1.java.lang.String
39
2.java.lang.Byte
3.java.lang.Short
4.java.lang.StringBuilder

Answer: (d) java.lang.StringBuilder


Explanation: A mutable class is a class in which changes can be made after its creation. We can modify the
internal state and fields of a mutable class. The StringBuilder class is a mutable class, as it can be altered
after it is created.
The String, Byte, and Short are immutable classes as they cannot be altered once they are created.
Hence, the correct answer is option (d).
Which of the given methods are of Object class?
1.notify(), wait( long msecs ), and synchronized()
40
2.wait( long msecs ), interrupt(), and notifyAll()
3.notify(), notifyAll(), and wait()
4.sleep( long msecs ), wait(), and notify()
Which of the given methods are of Object class?
1.notify(), wait( long msecs ), and synchronized()
40
2.wait( long msecs ), interrupt(), and notifyAll()
3.notify(), notifyAll(), and wait()
4.sleep( long msecs ), wait(), and notify()

Answer: (c) notify(), notifyAll(), and wait()


Explanation: The notify(), notifyAll(), and wait() are the methods of the Object class. The notify() method
is used to raise a single thread that is waiting on the object's monitor. The notifyAll() method is similar to
the notify() method, except that it wakes up all the threads that are waiting on the object's monitor. The
wait() method is used to make a thread to wait until another thread invokes the notify() or notifyAll()
methods for an object.
Hence, the correct answer is option (c).
In which memory a String is stored, when we create a string using new operator?

1.Stack
41
2.String memory
3.Heap memory
4.Random storage space
In which memory a String is stored, when we create a string using new operator?

1.Stack
41
2.String memory
3.Heap memory
4.Random storage space

Answer: (c) Heap memory


Explanation: When a String is created using a new operator, it always created in the heap memory.
Whereas when we create a string using double quotes, it will check for the same value as of the string in
the string constant pool. If it is found, returns a reference of it else create a new string in the string
constant pool.
Hence, the correct answer is option (c).
Which of these classes are the direct subclasses of the Throwable class?
42
A. RuntimeException and Error class
B. Exception and VirtualMachineError class
C. Error and Exception class
D. IOException and VirtualMachineError class
Which of these classes are the direct subclasses of the Throwable class?
42
A. RuntimeException and Error class
B. Exception and VirtualMachineError class
C. Error and Exception class
D. IOException and VirtualMachineError class

Answer: (c) Error and Exception class

Explanation: According to the class hierarchy of Throwable class, the Error and Exception classes are the direct subclasses
of the Throwable class, as shown below.

Java Multiple Choice Questions


The RuntimeException, IOException, and VirtualMachineError classes are the subclasses of the Exception and Error classes.

Hence, the correct answer is option (c).


Which option is false about the final keyword?

1.
2.
A final method cannot be overridden in its subclasses.
A final class cannot be extended.
43
3. A final class cannot extend other classes.
4. A final method can be inherited.
Which option is false about the final keyword?

1.
2.
A final method cannot be overridden in its subclasses.
A final class cannot be extended.
43
3. A final class cannot extend other classes.
4. A final method can be inherited.

Answer: (c) A final class cannot extend other classes.

Explanation: The final is a reserved keyword in Java that is used to make a variable, method, and class immutable. The
important features of the final keyword are:

Using the final keyword with a variable makes it constant or immutable. We can't reassign the values of it.
A final variable must be a local variable and cannot be used in other classes.
Using the final keyword with a method makes it constant, and we can't override it in the subclass.
Using final with a class makes the class constant, and we cannot extend a final class. But a final class can extend other
classes.
Hence, the correct answer is option (c).
Which one of the following is the correct way for calling the JavaScript code?

A.
B.
Preprocessor
Triggering Event
44
C. RMI
D. Function/Method
Which one of the following is the correct way for calling the JavaScript code?

A.
B.
Preprocessor
Triggering Event
44
C. RMI
D. Function/Method

Answer: D

Explanation: The JavaScript code can be called simply by making the function call to the element on which the
JavaScript code execution has to be run. There are several other ways to call JavaScript code such as submit, onclick,
and onload, etc.
45
Which of the following type of a variable is volatile?
1.Mutable variable
2.Dynamic variable
3.Volatile variable
4.Immutable variable
Which of the following type of a variable is volatile?
1.Mutable variable
45
2.Dynamic variable
3.Volatile variable
4.Immutable variable

Answer: A
Explanation: The variables whose value can be modified that kind of variable are
known as Mutable variable. In the JavaScript, only arrays and objects are mutable but
not the primitive values.
In the JavaScript, which one of the following is not considered as an error:
46
A. Syntax error
B. Missing of semicolons
C. Division by zero
D. Missing of Bracket
In the JavaScript, which one of the following is not considered as an error:
46
A. Syntax error
B. Missing of semicolons
C. Division by zero
D. Missing of Bracket

Answer: C

Explanation: Yes, you heard right that division of any integer by zero is not an error in the JavaScript. It just prints the
infinity as a result. However, there is an exception in JavaScript, dividing zero with zero will not have any defined
number/value so, the result of this specific operation is a special value "Not a Number" (or NaN) and printed as NaN.
In JavaScript the x===y statement implies that: 47
1.Both x and y are equal in value, type and reference address as well.
2.Both are x and y are equal in value only.
3.Both are equal in the value and data type.
4.Both are not same at all.
In JavaScript the x===y statement implies that:
47
1.Both x and y are equal in value, type and reference address as well.
2.Both are x and y are equal in value only.
3.Both are equal in the value and data type.
4.Both are not same at all.

Answer: C
Explanation: The "===" statement are called strict comparison which only
gets true only if the type and content of both the operand are strictly same.
JavaScript is a ________ Side Scripting Language.
A) Server
48
B) ISP
C) Browser
D) None of the above
JavaScript is a ________ Side Scripting Language.
A) Server
48
B) ISP
C) Browser
D) None of the above
Ans: Option C
Explanation: JavaScript is a Browser Side Scripting Language. ASP, PHP, Perl are Server Side
Scripting Language.
Which was the first browser to support JavaScript?
A) Mozilla Firefox
B) Netscape
49
C) Google Chrome
D) IE
Which was the first browser to support JavaScript?
A) Mozilla Firefox
B) Netscape
49
C) Google Chrome
D) IE
Ans: B
Explanation: Netscape was the first web browser to support JavaScript.
JavaScript can be written __________
a) directly into JS file and included into HTML
b) directly on the server page
50
c) directly into HTML pages
d) directly into the css file
JavaScript can be written __________
a) directly into JS file and included into HTML
b) directly on the server page
50
c) directly into HTML pages
d) directly into the css file

Answer: a
Explanation: JavaScript files can be saved by .JS extension and can be included in the HTML files. Script tag along
with src attribute is used to include the js files.
GATE NoteBook
Target JRF - UGC NET Computer Science Paper 2

1000 MEQs
50 Qs on Programming
Languages & Computer Graphics
Most Expected Questions Course
Which of the following is not JavaScript Data Types?

A. Undefined
851
B. Number
C. Boolean
D. Float
Which of the following is not JavaScript Data Types?

A. Undefined
851
B. Number
C. Boolean
D. Float

Ans : D
Explanation: Following are the JavaScript Data types:
Number
String
Boolean
Object
Undefined
852. Pixel mask is a string containing the ___________ to indicate which positions to plot along
the line path.

a) digits 1
b) digits 0
c) both digits 1 and 0
d) none of these
852. Pixel mask is a string containing the ___________ to indicate which positions to plot along
the line path.

a) digits 1
b) digits 0
c) both digits 1 and 0
d) none of these

The mask 1111000, for instance, could be used to display


a dashed line with a dash length of four pixels and an
interdash spacing of three pixels
853. Which of the following is also known as the Depth-buffer method is one of the commonly used
method for hidden surface detection ?

a) Painter’s algorithm
b) Backface culling method
c) Z-buffer algorithm
d) Frame buffer algorithm
853. Which of the following is also known as the Depth-buffer method is one of the commonly used
method for hidden surface detection ?

a) Painter’s algorithm
b) Backface culling method
c) Z-buffer algorithm
d) Frame buffer algorithm
854. Z-buffer requires 2 type of buffers.which of the following buffer is to be filled ?

a) Depth buffer Space


b) Frame buffer Space
c) Both a) and b)
d) None of these
854. Z-buffer requires 2 type of buffers.which of the following buffer is to be filled ?

a) Depth buffer Space


b) Frame buffer Space
c) Both a) and b)
d) None of these
855. How much memory is required to implement z-buffer algorithm for a 512 x 512 x 24 bit-
plane image?

a) 768 KB
b) 1 MB
c) 1.5 MB
d) 2 MB
855. How much memory is required to implement z-buffer algorithm for a 512 x 512 x 24 bit-
plane image?

a) 768 KB
b) 1 MB
c) 1.5 MB
d) 2 MB
Frame buffer Space required by depth buffer = 512 x 512 x 240
= 6291456 bits.
Space required by frame buffer = 512 x 512 x 24
= 6291456 bits.
Total space required = 6291456 + 6291456 bits
= 12582912 bits

≈ 1.5 MB
856. In graphics, the number of vanishing points depends on

1. the number of axes cut by the projection plane


2. the centre of projection
3. the number of axes which are parallel to the projection plane
4. the perspective projections of any set of parallel lines that are not parallel to the projection
plane

a) 1 and 3
b) 2 and 4
c) Only 4
d) Only 3
e) Only 1
856. In graphics, the number of vanishing points depends on

1. the number of axes cut by the projection plane


2. the centre of projection
3. the number of axes which are parallel to the projection plane
4. the perspective projections of any set of parallel lines that are not parallel to the projection
plane

a) 1 and 3
b) 2 and 4 A vanishing point is a point on the image plane of a
perspective drawing where the two-dimensional
c) Only 4 perspective projections (or drawings) of mutually
parallel lines in three-dimensional space appear to
d) Only 3 converge.
e) Only 1
857. In z – buffer, No background colour is initiated even at the start of algorithm.
Consider the statements :
I. the size of objects can be large.
II. the depth of object is compared and not the entire object.
III. Comparisons of objects is done
IV. It is a depth sort algorithm

Which is/are FALSE ?


a) I & II
b) III & IV
c) I, III & IV
d) All are TRUE
e) All are FALSE
857. In z – buffer, No background colour is initiated even at the start of algorithm.
Consider the statements :
I. the size of objects can be large.
II. the depth of object is compared and not the entire object.
III. Comparisons of objects is done
IV. It is a depth sort algorithm

Which is/are FALSE ?


a) I & II
b) III & IV
c) I, III & IV
d) All are TRUE III. False - as only the depth of object is compared and not the entire object.
e) All are FALSE IV. False - as it is a depth buffer and not depth sort algorithm.
858. A system is having 8 M bytes of video memory for bit-mapped graphics with 64-bit
colour. What is the maximum resolution it can support?

a) 800 x 600
b) 1024 x 768
c) 1280 x 1024
d) 1920 x 1440
858. A system is having 8 M bytes of video memory for bit-mapped graphics with 64-bit
colour. What is the maximum resolution it can support?

a) 800 x 600
b) 1024 x 768
c) 1280 x 1024
d) 1920 x 1440

Maximum file size = M = 8 MByte = 83,88,608 Byte

A. 800 * 600 *8 byte = 38,40,000 < M

B. 1024 * 768 *8 byte = 62,91,456 < M (max resolution it can support)

C. 1280 * 1024 *8 byte = 1,04,85,760 > M

D. 1920 *1440 *8 byte > M


859. Which of the following statement(s) is/are TRUE regarding segments in computer graphics ?

1. When visible attribute of segment is set to 1, it is called Posted segment.


2. When visible attribute of segment is set to 0, it is called Unposted segment.
3. Posted and Unposted segments are included in active segment list.
4. Posted and Unposted segments are not included in active segment list.

a) 1 and 2
b) 2 and 3
c) 3 and 4
d) 1 and 4
e) All of them except 4
859. Which of the following statement(s) is/are TRUE regarding segments in computer graphics ?

1. When visible attribute of segment is set to 1, it is called Posted segment.


2. When visible attribute of segment is set to 0, it is called Unposted segment.
3. Posted and Unposted segments are included in active segment list.
4. Posted and Unposted segments are not included in active segment list.

a) 1 and 2
b) 2 and 3
c) 3 and 4
d) 1 and 4
e) All of them except 4 3. Posted segment included in active segment list.
4. Unposted segment not included in active segment list.
Why segments required in Computer Graphics ?
To view an entire image or a part of image with various attributes, we need to organize image
information in a particular manner since existing structure of display file does not satisfy our
requirements of viewing an image.
To achieve this display, file is divided into Segments.
860. There are so many Advantages of using segmented display :

1. It allows to organize display files in sub-picture structure.


2. It allows to apply different set of attributes to different portions of image.
3. It makes it easier to the picture by changing/replacing segments.
4. It allows application of transformation on selective portions of image.

a) 1 and 2
b) 1, 2 and 3
c) 2, 3 and 4
d) All of them
e) None of them
860. There are so many Advantages of using segmented display :

1. It allows to organize display files in sub-picture structure.


2. It allows to apply different set of attributes to different portions of image.
3. It makes it easier to the picture by changing/replacing segments.
4. It allows application of transformation on selective portions of image.

a) 1 and 2
b) 1, 2 and 3
c) 2, 3 and 4
d) All of them
e) None of them
861. What is the bit rate of a video terminal unit with 80 characters/line, 8 bits/character and horizontal
sweep time of 100 μs (including 20 μs of retrace time)?

a) 8 Mbps
b) 6.4 Mbps
c) 0.8 Mbps
d) 0.64 Mbps
861. What is the bit rate of a video terminal unit with 80 characters/line, 8 bits/character and horizontal
sweep time of 100 μs (including 20 μs of retrace time)?

a) 8 Mbps
b) 6.4 Mbps
c) 0.8 Mbps
d) 0.64 Mbps

Bit rate of a video terminal unit


= 80×8 bits/100µs
=6.4 Mbps
862. The term Phong associated with shading. It is a per-fragment color computation.

Which statement is/are TRUE ?


S1 -The vertex shader provides the normal and position data as out variables to the fragment shader.
S2 -The fragment shader then interpolates these variables and computes the color into black and white
format.

A) ONLY S1
B) ONLY S2
C) BOTH S1 AND S2
D) NEITHER S1 NOR S2
862. The term Phong associated with shading. It is a per-fragment color computation.

Which statement is/are TRUE ?


S1 -The vertex shader provides the normal and position data as out variables to the fragment shader.
S2 -The fragment shader then interpolates these variables and computes the color into black and white
format.

A) ONLY S1
B) ONLY S2
C) BOTH S1 AND S2
D) NEITHER S1 NOR S2

The fragment shader then interpolates these variables


and computes the color
863. ______________ is designed to flood the entire screen with electrons and collector is partly energized
by ________________ , stores the charge generated by the writing gun.

a) Writing gun, flooding gun


b) Phosphorus grains, flooding gun
c) Flooding gun, flooding gun
d) None of these
863. ______________ is designed to flood the entire screen with electrons and collector is partly energized
by ________________ , stores the charge generated by the writing gun.

a) Writing gun, flooding gun


b) Phosphorus grains, flooding gun
c) Flooding gun, flooding gun
d) None of these
864. collector is partly energized by flooding gun, stores the charge generated by the writing gun where
_____________ is used to discharge the collector

a) Phosphorus grains
b) Ground
c) Writing gun system
d) Flood gun
864. collector is partly energized by flooding gun, stores the charge generated by the writing gun where
_____________ is used to discharge the collector

a) Phosphorus grains
b) Ground
c) Writing gun system
d) Flood gun
865. Which option is appropriate about Phosphorus grains ?

i. It is used in memory - tube display and similar to those used in standard CRT.
ii. It is used in memory - tube display and basically the same as the electron gun used in a conventional
CRT.

a) i and ii are TRUE


b) Only i is TRUE
c) Only ii is TRUE
d) i and ii are NOT TRUE
865. Which option is appropriate about Phosphorus grains ?

i. It is used in memory - tube display and similar to those used in standard CRT.
ii. It is used in memory - tube display and basically the same as the electron gun used in a conventional
CRT.

a) i and ii are TRUE


b) Only i is TRUE
c) Only ii is TRUE
d) i and ii are NOT TRUE

Writing Gun System :


It is used in memory - tube display and basically the
same as the electron gun used in a conventional CRT.
866. A digital optical encoder is a device that
1. converts motion into a sequence of digital pulses.
2. provides square-wave signals.
3. Contains a disc which has 4 channels divided into "n" equal angular intervals.

a) 1 and 2
b) 2 and 3
c) 1 and 3
d) All of them
e) None of them
866. A digital optical encoder is a device that
1. converts motion into a sequence of digital pulses.
2. provides square-wave signals.
3. Contains a disc which has 4 channels divided into "n" equal angular intervals.

a) 1 and 2
b) 2 and 3
c) 1 and 3
d) All of them
e) None of them

Contains a disc which has 2 channels


867. By using an eight bit optical encoder the degree of resolution that can be obtained is
(approximately)

a) 1.8o
b) 3.4o
c) 2.8o
d) 1.4o
867. By using an eight bit optical encoder the degree of resolution that can be obtained is
(approximately)

a) 1.8o
b) 3.4o
c) 2.8o
d) 1.4o

Resolution is defined as the smallest


discernible quantity. (discernible = clear)
Resolution = 360/2n
= 360/28
= 360/256
= 1.4o
868. Tablet, Joystick are considered as _____________ devices and Locator, Keyboard are considered as
________ devices.
a) Continuous, logical
b) Logical, direct
c) 3d, logical
d) 3d, direct
868. Tablet, Joystick are considered as _____________ devices and Locator, Keyboard are considered as
________ devices.
a) Continuous, logical
b) Logical, direct
c) 3d, logical
d) 3d, direct
869. Light Pen, Touch Screen are considered as _____________ devices and Data Globe, Sonic Pen are
considered as ________ devices.
a) Continuous, logical
b) Direct, 3d
c) 3d, logical
d) 3d, direct
869. Light Pen, Touch Screen are considered as _____________ devices and Data Globe, Sonic Pen are
considered as ________ devices.
a) Continuous, logical
b) Direct, 3d
c) 3d, logical
d) 3d, direct
870. Which of the following statement(s) is/are TRUE regarding Orthographic Projection ?

1. The direction of projection is chosen so that there is no foreshortening of lines perpendicular to the xy plane.
2. The direction of projection is chosen so that lines perpendicular to the xy planes are foreshortened by half their
lengths.
3. The direction of projection makes equal angles with all of the principal axis.
4. Projections are characterized by the fact that the direction of projection is perpendicular to the view plane.

a) 1 and 2
b) 1, 2 and 3
c) Only 4
d) Only 2
e) All of them except 3
870. Which of the following statement(s) is/are TRUE regarding Orthographic Projection ?

1. The direction of projection is chosen so that there is no foreshortening of lines perpendicular to the xy plane.
2. The direction of projection is chosen so that lines perpendicular to the xy planes are foreshortened by half their
lengths.
3. The direction of projection makes equal angles with all of the principal axis.
4. Projections are characterized by the fact that the direction of projection is perpendicular to the view plane.

a) 1 and 2
b) 1, 2 and 3
c) Only 4
d) Only 2
e) All of them except 3
1. Cavalier Projection :- The direction of projection is chosen so that there is no foreshortening of
lines perpendicular to the xy plane.

2. Cabinet Projection :- The direction of projection is chosen so that lines perpendicular to the xy
planes are foreshortened by half their lengths.

3. Isometric Projection :- The direction of projection makes equal angles with all of the principal axis.

4. Orthographic Projection :- Projections are characterized by the fact that the direction of projection
is perpendicular to the view plane.
871. Which is the CORRECT point about Painter’s Algorithm ?

1. It came under the category of list priority algorithm.


2. It is also called a depth-sort algorithm.

a) Only 1
b) Only 2
c) Both
d) None
871. Which is the CORRECT point about Painter’s Algorithm ?

1. It came under the category of list priority algorithm.


2. It is also called a depth-sort algorithm.

a) Only 1
b) Only 2
c) Both
d) None
872. In Painter’s algorithm, ordering of visibility of an object is done. __________________
then correct picture results.

a) If objects are arranged in ascending order


b) If objects are sequenced in a order
c) If objects are reversed in a particular order
d) If objects are arranged in alphabetical order
872. In Painter’s algorithm, ordering of visibility of an object is done. __________________
then correct picture results.

a) If objects are arranged in ascending order


b) If objects are sequenced in a order
c) If objects are reversed in a particular order
d) If objects are arranged in alphabetical order
873. Back Face Removal Algorithm is used to plot only surfaces which will face the
camera.
This method will remove 50% of polygons from the scene if

a) the parallel projection is used.


b) the perspective projection is used.
c) the object is nearer to the center of projection
d) Either a) or b)
e) Either b) or c)
873. Back Face Removal Algorithm is used to plot only surfaces which will face the
camera.
This method will remove 50% of polygons from the scene if

a) the parallel projection is used.


b) the perspective projection is used.
c) the object is nearer to the center of projection
d) Either a) or b)
e) Either b) or c)

If the perspective projection is used then more than


50% of the invisible area will be removed.
874.In Back Face Removal Algorithm, the object is nearer to the center of projection,
number of polygons

a) from the front will be removed.


b) from the centre will be removed.
c) from the back will be removed.
d) from the corner will be removed.
874.In Back Face Removal Algorithm, the object is nearer to the center of projection,
number of polygons

a) from the front will be removed.


b) from the centre will be removed.
c) from the back will be removed.
d) from the corner will be removed.
875. Which is CORRECT regarding Back Face Removal Algorithm ?

1) It reduces the size of databases


2) acts a preprocessing step for another algorithm.
3) It consider the interaction between various objects.
4) Each polygon has several vertices and all vertices are numbered in clockwise.

a) 1, 2 and 3
b) 1, 2 and 4
c) 2, 3 and 4
d) All are TRUE
e) All are NOT TRUE
875. Which is CORRECT regarding Back Face Removal Algorithm ?

1) It reduces the size of databases


2) acts a preprocessing step for another algorithm.
3) It consider the interaction between various objects.
4) Each polygon has several vertices and all vertices are numbered in clockwise.

a) 1, 2 and 3
b) 1, 2 and 4
c) 2, 3 and 4
d) All are TRUE
e) All are NOT TRUE
1) It reduces the size of databases. WHY ? (TRUE)
because no need of store all surfaces in the database, only the visible surface is stored.

2) Acts a preprocessing step for another algorithm. (TRUE)

3) It consider the interaction between various objects. (FALSE)


Because it applies to individual objects therefore, it does not consider the interaction between
various objects.

4) Each polygon has several vertices and all vertices are numbered in clockwise. (TRUE)
876. Translation is the straight line movement of an object from one position to another
where the object is positioned from one coordinate location to another.

1. It is a movement of objects without deformation.


2. Every position or point is translated by the same amount.
3. When the straight line is translated, then it will be drawn using midpoints.

a) 1 and 2 are TRUE


b) 1 and 3 are FALSE
c) All are TRUE
d) All are TRUE except 1
876. Translation is the straight line movement of an object from one position to another
where the object is positioned from one coordinate location to another.

1. It is a movement of objects without deformation.


2. Every position or point is translated by the same amount.
3. When the straight line is translated, then it will be drawn using midpoints.

a) 1 and 2 are TRUE


b) 1 and 3 are FALSE
c) All are TRUE
d) All are TRUE except 1 When the straight line is translated, then it will be
drawn using endpoints.
TRANSLATION OF POINT:

To translate a point from coordinate position (x, y) to another (x1 y1), we add algebraically the translation
distances Tx and Ty to original coordinate.

x1=x+Tx
y1=y+Ty

The translation pair (Tx,Ty) is called as shift vector.


877. Random Scan System uses an electron beam which operates like a pencil to create a line image on
the CRT screen. It has high Resolution and more expensive.

Which of the following is NOT CORRECT ?


I. Refresh rate does not depend on the picture.
II. Beam Penetration technology come under it.
III. It is suitable for realistic display.
IV. Solid pattern is tough to fill.

a) 1 and 2
b) 3 and 4
c) 1 and 3
d) 2 and 4
877. Random Scan System uses an electron beam which operates like a pencil to create a line image on
the CRT screen. It has high Resolution and more expensive.

Which of the following is NOT CORRECT ?


I. Refresh rate does not depend on the picture. (Raster Scan)
II. Beam Penetration technology come under it.
III. It is suitable for realistic display. (Raster Scan)
IV. Solid pattern is tough to fill.

a) 1 and 2
b) 3 and 4
c) 1 and 3
d) 2 and 4
Random Scan Raster Scan
1. It has high Resolution 1. Its resolution is low.
2. It is more expensive 2. It is less expensive
3. Any modification if needed is easy 3.Modification is tough

4. Solid pattern is tough to fill 4.Solid pattern is easy to fill


5. Refresh rate depends or resolution 5. Refresh rate does not depend on the picture.

6. Only screen with view on an area is displayed. 6. Whole screen is scanned.

7. Beam Penetration technology come under it. 7. Shadow mark technology came under this.

8. It does not use interlacing method. 8. It uses interlacing

9. It is restricted to line drawing applications 9. It is suitable for realistic display.


878. Digital Differential Analyzer is an incremental method of scan conversion of line. In
this method,

a) calculation is performed at each step but by using inverted results of previous steps.
b) calculation is performed at each step but by using results of previous steps.
c) calculation is performed at each step but by denying results of previous steps.
d) All of the above
e) None of these
878. Digital Differential Analyzer is an incremental method of scan conversion of line. In
this method,

a) calculation is performed at each step but by using inverted results of previous steps.
b) calculation is performed at each step but by using results of previous steps.
c) calculation is performed at each step but by denying results of previous steps.
d) All of the above
e) None of these
879. Which statement(s) is/are NOT CORRECT about Digital Differential Analyzer ?

S1 - This method uses multiplication theorem.


S2 - It is a faster method than method of using direct use of line equation.
S3 - This method gives overflow indication when a point is removed.

a) S1 & S2
b) S2 & S3
c) S1 & S3
d) All are TRUE
e) None of these
879. Which statement(s) is/are NOT CORRECT about Digital Differential Analyzer ?

S1 - This method uses multiplication theorem.


S2 - It is a faster method than method of using direct use of line equation.
S3 - This method gives overflow indication when a point is removed.

a) S1 & S2
b) S2 & S3
c) S1 & S3
S1 - This method does not uses multiplication theorem.
d) All are TRUE
S2 - It is a faster method than method of using direct use of line equation.
e) None of these S3 - This method gives overflow indication when a point is repositioned.
880. Midpoint Subdivision Line Clipping is suitable for machines in which

1) multiplication operation is possible.


2) division operation is possible.
3) multiplication operation is not possible.
4) division operation is not possible.

a) 1 and 2
b) 3 and 4
c) 1 and 3
d) 2 and 4
880. Midpoint Subdivision Line Clipping is suitable for machines in which

1) multiplication operation is possible.


2) division operation is possible.
3) multiplication operation is not possible.
4) division operation is not possible.

Midpoint Subdivision Line Clipping is suitable for


a) 1 and 2 machines in which multiplication and division operation
is not possible.
b) 3 and 4
WHY ??
c) 1 and 3 Because it can be performed by introducing clipping
divides in hardware.
d) 2 and 4
881. Liang and Barsky have established Liang-Barsky Line Clipping algorithm that :
a) uses floating-point arithmetic
b) finds the appropriate endpoints with at most four computations.
c) Both a) and b)
d) None of these
881. Liang and Barsky have established Liang-Barsky Line Clipping algorithm that :
a) uses floating-point arithmetic
b) finds the appropriate endpoints with at most four computations.
c) Both a) and b)
d) None of these
882. _________________ calculates end-points very quickly and rejects and accepts
lines quickly and can clip pictures much large than screen size.

a) Cohen Sutherland Line Clipping Algorithm


b) Midpoint Subdivision Line Clipping Algorithm
c) Liang-Barsky Line Clipping Algorithm
d) All of them
e) None of them
882. _________________ calculates end-points very quickly and rejects and accepts
lines quickly and can clip pictures much large than screen size.

a) Cohen Sutherland Line Clipping Algorithm


b) Midpoint Subdivision Line Clipping Algorithm
c) Liang-Barsky Line Clipping Algorithm
d) All of them
e) None of them
883. Which one of the following are essential features of an object-oriented programming language?

(i) Abstraction and encapsulation


(ii) Strictly-typedness
(iii) Type-safe property coupled with sub-type rule
(iv) Polymorphism in the presence of inheritance

a) (i) and (ii) only


b) (i) and (iv) only
c) (i), (ii) and (iv) only
d) (i), (iii) and (iv) only
883. Which one of the following are essential features of an object-oriented programming language?

(i) Abstraction and encapsulation


(ii) Strictly-typedness
(iii) Type-safe property coupled with sub-type rule
(iv) Polymorphism in the presence of inheritance

a) (i) and (ii) only


b) (i) and (iv) only
c) (i), (ii) and (iv) only
d) (i), (iii) and (iv) only
884. It is desired to design an object-oriented employee record system for a company. Each employee
has a name, unique id and salary. Employees belong to different categories and their salary is
determined by their category. The functions to get Name, getld and compute salary are required.
Given the class hierarchy below, possible locations for these functions are:

i. getld is implemented in the superclass


ii. getld is implemented in the subclass EMP
iii. getName is an abstract function in the superclass
iv. getName is implemented in the superclass
v. getName is implemented in the subclass
vi. getSalary is an abstract function in the superclass
vii. getSalary is implemented in the superclass MANAGER ENGINEER SECRETARY
viii. getSalary is implemented in the subclas

Choose the best design


a) (i), (iv), (vi), (viii)
b) (i), (iv), (vii)
c) (i), (iii), (v), (vi), (viii)
d) (ii), (v), (viii)
884. It is desired to design an object-oriented employee record system for a company. Each employee
has a name, unique id and salary. Employees belong to different categories and their salary is
determined by their category. The functions to get Name, getld and compute salary are required.
Given the class hierarchy below, possible locations for these functions are:

i. getld is implemented in the superclass


ii. getld is implemented in the subclass EMP
iii. getName is an abstract function in the superclass
iv. getName is implemented in the superclass
v. getName is implemented in the subclass
vi. getSalary is an abstract function in the superclass
vii. getSalary is implemented in the superclass MANAGER ENGINEER SECRETARY
viii. getSalary is implemented in the subclas

Choose the best design


a) (i), (iv), (vi), (viii)
b) (i), (iv), (vii)
c) (i), (iii), (v), (vi), (viii)
d) (ii), (v), (viii)
885. Which of the following is associated with objects?
1) State
2) Behaviour
3) Identity

A) 1 and 2
B) 2 and 3
C) 1 and 3
D) All of the above
E) None of the above
885. Which of the following is associated with objects?
1) State
2) Behaviour
3) Identity

A) 1 and 2
B) 2 and 3
C) 1 and 3
D) All of the above
E) None of the above
886. Which statement(s) is/are CORRECT about Encapsulation in OOPs ?

S1 – It allows us to focus on what something does without considering the


complexities of how it works.
S2 – It allows us to consider complex ideas while ignoring irrelevant detail that
would confuse us.

a) S1 Only
b) S2 Only
c) Both are TRUE
d) None of these
886. Which statement(s) is/are CORRECT about Encapsulation in OOPs ?

S1 – It allows us to focus on what something does without considering the


complexities of how it works.
S2 – It allows us to consider complex ideas while ignoring irrelevant detail that
would confuse us. (ABSTRACTION)

a) S1 Only
b) S2 Only
c) Both are TRUE
d) None of these
887. The feature in object-oriented programming that allows the same operation to
be carried out differently, depending on the object, is:

a) Inheritance
b) Polymorphism
c) Overfunctioning
d) Overriding
887. The feature in object-oriented programming that allows the same operation to
be carried out differently, depending on the object, is:

a) Inheritance
b) Polymorphism
c) Overfunctioning
d) Overriding
888. _______________ is a static or compile time binding and ____________ is
dynamic or runtime binding.

A) Overriding, Overloading
B) Overriding, Overriding
C) Overloading, Overriding
D) Overloading, Overloading
888. _______________ is a static or compile time binding and ____________ is
dynamic or runtime binding.

A) Overriding, Overloading
B) Overriding, Overriding
C) Overloading, Overriding
D) Overloading, Overloading
889. Which of the following is TRUE only for XML but NOT HTML?

(A) It is derived from SGML


(B) It describes content and layout
(C) It allows user defined tags
(D) It is restricted only to be used with web browsers
889. Which of the following is TRUE only for XML but NOT HTML?

SGML stands for Standard Generalized Markup


(A) It is derived from SGML Language
It was extended to HTML and XML.
(B) It describes content and layout
(C) It allows user defined tags
(D) It is restricted only to be used with web browsers

(A) It is derived from SGML (TRUE FOR BOTH)


(B) It describes content and layout (TRUE FOR BOTH)
(C) It allows user defined tags (TRUE FOR XML ONLY)
(D) It is restricted only to be used with web browsers (TRUE FOR BOTH)
890. HTML has language elements which permit certain actions other than describing
the structure of the web document. Which one of the following actions is NOT
supported by pure HTML (without any server or client side scripting) pages?

a) Embed web objects from different sites into the same page
b) Refresh the page automatically after a specified interval
c) Automatically redirect to another page upon download
d) Display the client time as part of the page
890. HTML has language elements which permit certain actions other than describing
the structure of the web document. Which one of the following actions is NOT
supported by pure HTML (without any server or client side scripting) pages?

a) Embed web objects from different sites into the same page
b) Refresh the page automatically after a specified interval
c) Automatically redirect to another page upon download
d) Display the client time as part of the page
891. Which of the following is an advantage of putting presentation information in a
separate CSS file rather than in HTML itself?

1) The content becomes easy to manage


2) Becomes easy to make site for different devices like mobile by making separate CSS files
3) CSS Files are generally cached and therefore decrease server load and network traffic.

a) 1 and 2
b) 1 and 3
c) 2 and 3
d) Only 2
e) All of the above
891. Which of the following is an advantage of putting presentation information in a
separate CSS file rather than in HTML itself?

1) The content becomes easy to manage


2) Becomes easy to make site for different devices like mobile by making separate CSS files
3) CSS Files are generally cached and therefore decrease server load and network traffic.

a) 1 and 2
b) 1 and 3
c) 2 and 3
d) Only 2
e) All of the above
892. Which of following statements is/are False ?

1. XML overcomes the limitations in HTML to support a structured way of organizing content.

2. XML specification is not case sensitive while HTML specification is case sensitive.

3. XML supports user defined tags while HTML uses pre-defined tags.

4. XML tags need not be closed while HTML tags must be closed.

a) 2 only
b) 1 only
c) 2 and 4 only
d) 3 and 4 only
e) All of the above
892. Which of following statements is/are False ?

1. XML overcomes the limitations in HTML to support a structured way of organizing content.

2. XML specification is not case sensitive while HTML specification is case sensitive.

3. XML supports user defined tags while HTML uses pre-defined tags.

4. XML tags need not be closed while HTML tags must be closed.

a) 2 only
b) 1 only
c) 2 and 4 only
d) 3 and 4 only
e) All of the above
893. Which of the following is statement(s) is/are TRUE ?

1) Valid XML has a DTD associated with it and has been verified against all the rules
contained in the DTD in addition to being well-formed.

2) well-formed XML, on the other hand, is not necessarily valid, although it may be. In
order to know the rules for a well formed document

a) Only 1
b) Only 2
c) Both 1 and 2
d) None of these
893. Which of the following is statement(s) is/are TRUE ?

1) Valid XML has a DTD associated with it and has been verified against all the rules
contained in the DTD in addition to being well-formed.

2) well-formed XML, on the other hand, is not necessarily valid, although it may be. In
order to know the rules for a well formed document

a) Only 1
b) Only 2
c) Both 1 and 2
d) None of these
894. A HTML form is to be designed to enable purchase of office stationery.
Required items are to be selected (checked). Credit card details are to be entered
and then the submit button is to be pressed. Which one of the following options
would be appropriate for sending the data to the server. Assume that security is
handled in a way that is transparent to the form design.

a) Only GET
b) Only POST
c) Either of GET or POST
d) Neither GET nor POST
894. A HTML form is to be designed to enable purchase of office stationery.
Required items are to be selected (checked). Credit card details are to be entered
and then the submit button is to be pressed. Which one of the following options
would be appropriate for sending the data to the server. Assume that security is
handled in a way that is transparent to the form design.

GET is NOT SECURE, whatever data you transfer is goes as part of URI and
a) Only GET
that's why it's visible to whole world, you can not send any confidential data
using this method.
b) Only POST
POST sends data as part of HTTP request body, which can be encrypted using
c) Either of GET or POST
SSL and TLS. This is the reason all confidential data from client to server
transffered using POST method.
d) Neither GET nor POST
Example :- username and password when you login to internet banking, or
any online portal.
895. XPath is used to navigate through elements and attributes in

a) XSL document
b) XML document
c) XHTML document
d) XQuery document
895. XPath is used to navigate through elements and attributes in

a) XSL document
b) XML document
c) XHTML document
d) XQuery document
896. Choose the most appropriate HTML tag in the following to create a
numbered lists.

a) < dl >
b) < ul >
c) < li >
d) < ol >
896. Choose the most appropriate HTML tag in the following to create a
numbered lists.

a) < dl >
b) < ul >
c) < li >
d) < ol >
In HTML < ol > and < ul > commands are used along
with < li > command to create ordered and unordered
lists respectively.
897. In HTML, which of the following can be considered a container?

a) SELECT
b) Value
c) INPUT
d) BODY
897. In HTML, which of the following can be considered a container?

a) SELECT
b) Value
c) INPUT
d) BODY

 Container tags are all those tags which enclose other tags inside them.
 Several other tags can form a nested-tag structure inside these tags.
 Example: html tag, body tag, heading tags etc.
898. Cloaking is a search engine optimization (SEO) technique.
During cloaking, _______________________

a) Content presented to search engine spider is different from that presented to user's
browser
b) Content present to search engine spider and browser is same
c) Contents of user's requested website are changed
d) None of the above
898. Cloaking is a search engine optimization (SEO) technique.
During cloaking, _______________________

a) Content presented to search engine spider is different from that presented to user's
browser
b) Content present to search engine spider and browser is same
c) Contents of user's requested website are changed
d) None of the above
899. XML documents form a ________ structure.

a) Binary Tree
b) Tree
c) Linear List
d) Graph
899. XML documents form a ________ structure.

a) Binary Tree
b) Tree XML as Tree Structure
c) Linear List  An XML document is always descriptive.
d) Graph  The tree structure is often referred to as XML Tree and plays an important role
to describe any XML document easily.
 The tree structure contains root (parent) elements, child elements and so on.
 By using tree structure, you can get to know all succeeding branches and sub-
branches starting from the root.
 The parsing starts at the root, then moves down the first branch to an
element, take the first branch from there, and so on to the leaf nodes.
900. Which of the provides a method to avoid element name conflicts in XML ?

a) Namespaces
b) DTD
c) CSS
d) DOM
900. Which of the provides a method to avoid element name conflicts in XML ?

a) Namespaces
b) DTD
c) CSS
d) DOM

In XML, element names are defined by the developer


which results in conflicts when trying to mix
documents from different XML applications.

Copy protected with Online-PDF-No-Copy.com

You might also like