GATE / CS ARCHIVE

SUBJECT COLLECTION

Engineering Mathematics & Other Topics · Other Computing Topics

6 questions, newest first

GATE CSE has asked 6 questions on Other Computing Topics (Engineering Mathematics & Other Topics) from 2003 to 2005, in 3 of the 46 papers; the most recent is in GATE CSE 2005. In the last five years it carried 0 marks per 100-mark paper on average, against 0.2 since 2003.

Not in the GATE 2027 syllabus. Object-oriented programming and programming paradigms are not named; the only language is C.

Browse topics
1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Declarative programming paradigms

Other Computing Topics

Question 3, GATE 2005: Common property of logic and functional languages? A procedural; B based on lambda calculus; C declarative; D use Horn clauses.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Logic programming states logical relations, while functional programming expresses computations through functions rather than imperative state-changing instruction sequences. Both are conventionally classified as declarative, C. Lambda calculus is the usual basis for functional programming; Horn clauses are associated with logic programming, not both paradigms.

Logic programs describe facts/rules and functional programs compose function expressions. Both conventionally emphasize what result or relation is specified rather than a sequence of mutable-state commands, hence declarative. Functional foundations commonly use lambda calculus; Horn clauses are associated with logic programming. Neither foundation is common to both simply because both are declarative.

Original paper, page 1

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Object-oriented language features

Other Computing Topics

Question 4, GATE 2005: Which are essential conventional OOP features? I abstraction/encapsulation; II strict typing; III type safety with subtype rule; IV polymorphism with inheritance. A I/II; B I/IV; C I/II/IV; D I/III/IV.
Tap to enlarge
Your answer
Answer & solution

Answer: B under the conventional classification (no official key was published)

Abstraction/encapsulation and subtype polymorphism with inheritance are standard object-oriented features, statements i and iv. Object-oriented languages can be dynamically typed and need not enforce the particular strict typing/type-safety requirements in ii and iii. Thus B. This is the conventional feature taxonomy, not a theorem that every language called object-oriented must use class inheritance.

Encapsulation groups state with operations and hides representation, while polymorphism allows a common interface to have different implementations. These are I and IV in the question’s conventional taxonomy. Dynamic object-oriented languages show that strict static typing is not required; the specific type-safety/subtyping rule is also not universal. The classification is pedagogical, not a mathematical definition excluding prototype-based OOP.

Original paper, page 1

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Employee-class design

Other Computing Topics

Question 34, GATE 2004: An employee system has superclass Employee and subclasses Manager, Engineer and Secretary. Each employee has name, unique ID and salary; salary depends on category. Choose the best design for getName, getId and computeSalary (called getSalary in the numbered statements). (i) Implement getId in superclass; (ii) implement getId in subclass; (iii) getName abstract in superclass; (iv) implement getName in superclass; (v) implement getName in subclass; (vi) getSalary abstract in superclass; (vii) implement getSalary in superclass; (viii) implement getSalary in subclass.
Options:
(A) i,iv,vi,viii
(B) i,iv,vii
(C) i,iii,v,vi,viii
(D) ii,v,viii
Question 34, GATE 2004: An employee system has superclass Employee and subclasses Manager, Engineer and Secretary. Each employee has name, unique ID and salary; salary depends on category. Choose the best design for getName, getId and computeSalary (called getSalary in the numbered statements). (i) Implement getId in superclass; (ii) implement getId in subclass; (iii) getName abstract in superclass; (iv) implement getName in superclass; (v) implement getName in subclass; (vi) getSalary abstract in superclass; (vii) implement getSalary in superclass; (viii) implement getSalary in subclass.
Options:
(A) i,iv,vi,viii
(B) i,iv,vii
(C) i,iii,v,vi,viii
(D) ii,v,viii
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. The common name and identifier accessors can be implemented once in Employee, statements i and iv. Salary computation varies by employee category, so declare it abstract in Employee and implement it in each category subclass, vi and viii.

2. Thus A is the best listed design. The narrative says computeSalary while the numbered statements say getSalary; the intended varying salary operation is treated consistently.

3. Teaching check: Inheritance should share the common accessors while polymorphism handles category-specific salary rules. An abstract salary method specifies the common interface without imposing one implementation. Making getName abstract duplicates a behavior that the problem gives no reason to vary.

Original paper, page 4

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Match programming paradigms to descriptions

Other Computing Topics

Question 90, GATE 2004: Match styles P=functional, Q=logic, R=object-oriented, S=imperative with characteristics: (1) command-based, procedural; (2) imperative, abstract data types; (3) side-effect-free, declarative, expression evaluation; (4) declarative, clausal representation, theorem proving.
Options:
(A) P-2,Q-3,R-4,S-1
(B) P-4,Q-3,R-2,S-1
(C) P-3,Q-4,R-1,S-2
(D) P-3,Q-4,R-2,S-1
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Functional programming matches side-effect-free declarative expression evaluation (P→3). Logic programming matches declarative clauses and theorem proving (Q→4).

2. In this classification object-oriented programming matches imperative programming with abstract data types (R→2), while imperative programming matches command-based procedural computation (S→1). Thus P-3,Q-4,R-2,S-1 is D.

3. These are textbook paradigm characterizations, not claims that every language implementing a paradigm has only those features.

4. Teaching check: Match the most diagnostic feature first: theorem proving belongs to logic, and expression evaluation without side effects to functional programming. Those two matches fix P and Q, leaving abstract-data-type encapsulation for object orientation and procedural commands for imperative programming.

Original paper, page 12

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Static types and runtime subtypes

Other Computing Topics

Question 24, GATE 2003: Which typing statement is false? A. In statically typed languages each program variable has a fixed type; B. In untyped languages values do not have types; C. In dynamically typed languages variables have no types; D. In all statically typed languages each variable is associated with values of only a single type during execution.
Tap to enlarge
Your answer
Answer & solution

Answer: D under the standard polymorphic-language distinction (no official key was published)

1. Static type and runtime class are different concepts. A variable declared as a superclass reference retains that declared type while holding references to multiple subclasses. This gives a counterexample to D without implying that the compiler changes the declared type of the variable.

2. A variable in a statically typed language can have one declared static type while referring at different times to values of different compatible runtime subtypes. For example an Animal reference may refer to Dog and Cat objects. Thus D’s claim that values must have only a single runtime type in all statically typed languages is false. The other statements use the conventional distinction between declared variable types, dynamically typed values and untyped formalisms; that terminology is not uniform across every language theory.

Original paper, page 3

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Dynamic dispatch after an upcast

Other Computing Topics

Question 75, GATE 2003: A hypothetical object-oriented language supports inheritance and dynamic binding; do not assume Java or C++ semantics beyond those facts.
class P { void f(int i) { print(i); } }
class Q subclass of P { void f(int i) { print(2*i); } }
Execute:
P x=new Q();
Q y=new Q();
P z=new Q();
x.f(1); ((P)y).f(1); z.f(1);
The cast (P)y changes the reference type to P. What is printed?
A. 1 2 1  B. 2 1 1  C. 2 1 2  D. 2 2 2
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Each allocation is new Q(), so all three runtime objects have class Q even where the declared reference type is P.
2. Dynamic binding selects an override from the runtime class of the receiving object. The first call therefore invokes Q.f and prints 2×1=2.
3. Casting y to P affects its static reference type, not the object's runtime class. The second call still invokes Q.f, printing 2; z likewise points to a Q and prints 2.
4. Output 2 2 2 matches D. Static binding would be a different language rule from the one expressly stipulated.

Solution: Each allocated object is an instance of Q, including those referenced through a variable or cast of type P. With the stipulated dynamic binding, each call therefore selects Q's overriding method. For argument 1 that method prints 2, giving 2 2 2, option D. An upcast changes the reference's static type, not the runtime object or dynamically selected override.

Original paper, page 11