Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Identify Which of the following are List, Tuple and class?(a) arr [1, 2, 34] (b) arr (1, 2, 34)(c) student [rno, name, mark](d) day = (‘sun’ , ‘mon’, ‘tue’ , ‘wed’)(e) x= [2, 5, 6.5, [5,6], 8.2](f) employee [eno, ename, esal, eaddress]

Answer»

List: (a) arr [1, 2, 34]

(e) x= [2, 5, 6.5, [5,6], 8.2]

Tuple: (b) arr (1, 2, 34)

(d) day = (‘sun’ , ‘mon’, ‘tue’ , ‘wed’)

Class: (c) student [mo, name, mark]

(f) employee [eno, ename, esal, eaddress]

2.

Give the pseudo code to represent a rational number as a pair of two integers?

Answer»

You can now represent a rational number as a pair of two integers in pseudo code: a numerator and a denominator.

rational (n, d):

return [n, d]

numer (x):

return x [0]

denom (x):

return x [1]

3.

Give an example for representation of Tuple as a pair?

Answer»

Representation of Tuple as a Pair

nums : = (1, 2)

nums [0]

1

nums [1]

2

4.

nums [1] indicate that we are accessing …….. element.(a) 0(b) 1(c) 2(d) many

Answer»

nums [1] indicate that we are accessing 2 element.

5.

Which of the following is a compound structure?(a) Pair(b) Triplet(c) Single(d) Quadrat

Answer»

Pair is a compound structure

6.

Bundling two values together into one can be considered as ……(a) Pair(b) Triplet(c) Single(d) Quadrant

Answer»

Bundling two values together into one can be considered as Pair

7.

Give the pseudo code to compute the distance between two city objects?

Answer»

The following pseudo code will compute the distance between two city objects:

distance(city 1, city2):

1t1, 1g1: = getlat (city1), getlon (city1)

1t2, 1g2: = getlat (city2), getlon (city2)

return ((1t1 – 1t2) ** 2 + (1g1 – 1g2) ** 2)1/2

8.

A sequence of immutable objects is called ……(a) Built in(b) List(c) Tuple(d) Derived data

Answer»

A sequence of immutable objects is called Tuple

9.

Define class?

Answer»

A class as bundled data and the functions that work on that data.

10.

nums [1] represent that you are accessing …….. element.(a) 0(b) 1(c) 2(d) 3

Answer»

nums [1] represent that you are accessing 1 element.

11.

The data type whose representation is unknown are called …… (a) Built in data type (b) Derived data type(c) Concrete data type(d) Abstract datatype

Answer»

(d) Abstract datatype

12.

The data type whose representation is known are called …… (a) Built in data type (b) Derived data type (c) Concrete data type (d) Abstract data type

Answer»

(c) Concrete data type

13.

Which of the following is constructed by placing expressions within square brackets?(a) Tuples(b) Lists(c) Classes(d) Quadrats

Answer»

Lists is constructed by placing expressions within square brackets

14.

Differentiate constructors and selectors?

Answer»

Constructors are functions that build the abstract data type. Selectors are functions that retrieve information from the data type.

To create a city object, you’d use a function like

city = makecity (name, lat, Ion)

To extract the information of a city object, you would 

use functions like

getname (city)

15.

What is a Tuple? Give an example?

Answer»

A tuple is a comma-separated sequence of values surrounded with parentheses. Tuple is similar to a list. The difference between the two is that you cannot change the elements of a tuple once it is assigned whereas in a list, elements can be changed.

Example colour = (‘red’ , ‘blue’ , ‘Green’)

16.

Which strategy is used for program designing? Define that Strategy?

Answer»

We are using here a powerful strategy for designing programs: 

‘wishful thinking’. Wishful Thinking is the formation of beliefs and making decisions according to what might be pleasing to imagine instead of by . appealing to reality.

17.

Identify the constructor from the following(a) City = makecity(name, lat, lon) (b) getname(city)(c) getlat(city)(d) getlon(city)

Answer»

(a) City = makecity(name, lat, lon)

18.

How many ways of representing pair data type are there?(a) 1(b) 2(c) 3(d) 4

Answer»

There are 2 ways of representing pair data

19.

Which of the following allow to name the various parts of a multi – item object?(a) Tuples (b) Lists (c) Classes (d) quadrats

Answer»

Answer (c) Classes

20.

How many objects can be created from a class?(a) 0(b) 1(c) 2(d) many

Answer»

many objects can be created from a class

21.

…………. are the representation for ADT.(a) List(b) Classes(c) Int(d) Float

Answer»

Classes are the representation for ADT.

22.

The process of providing only the essentials and hiding the details is known as ……..(a) Modularity(b) Structure(c) Tuple(d) Abstraction

Answer»

(d) Abstraction

23.

: = is called as ………..(a) Assigned as(b) Becomes(c) Both a and b(d) None of these

Answer»

(c) Both a and b

24.

What are the two parts of a program?

Answer»

The two parts of a program are, the part that operates on abstract data and the part that defines a concrete representation.

25.

The Splitting of program into many modules are called as ……(a) Modularity(b) Structures(c) Classes(d) List

Answer»

(a) Modularity

26.

What are the different ways to access the elements of a list. Give example?

Answer»

List is constructed by placing expressions within square brackets separated by commas.

Example for 

List is [10, 20].

The elements of a list can be accessed in two ways. The first way is via our familiar method of multiple assignment, which unpacks a list into its elements and binds each element to a different name.

1st: = [10, 20]

x, y: = 1st

In the above example x will become 10 and y will become 20.

A second method for accessing the elements in a list is by the element selection operator, also expressed using square brackets. Unlike a list literal, a square – brackets expression directly following another expression does not evaluate to a list value, but instead selects an element from the value of the preceding expression.

1st [0]

10

1st [1]

20

27.

Which of the following functions that build the abstract data type?(a) Constructors(b) Destructors(c) Recursive(d) Nested

Answer»

(a) Constructors

28.

What is a List? Give an example?

Answer»

List is constructed by placing expressions within square brackets separated by commas.

Example for List is [10, 20].

29.

In list 1st [(0, 10), (1, 20)] – 0 and 1 represents ……(a) Value(b) Index(c) List identifier(d) Tuple

Answer»

In list 1st [(0, 10), (1, 20)] – 0 and 1 represents Index

30.

Which of the following functions that retrieve information from the data type? (a) Constructors(b) Selectors(c) Recursive(d) Nested

Answer»

(b) Selectors

31.

Identify Which of the following are constructors and selectors?

Answer»

(a) N1 = number ( ) – constructors

(b) Accetnum (n1) – selectors

(c) Displaynum (n1) – selectors

(d) eval (a/b) – selectors

(e) x, y = makeslope(m), makeslope (n) – constructors

(f) display O – selectors

32.

Linked list are of ……..(a) Single(b) Double(c) Multiple(d) Both a and b

Answer»

(d) Both a and b

33.

ADT stands for ……..(a) Advanced Data Typing(b) Application Developing Tool (c) Abstract data types(d) Advanced data types

Answer»

(c) Abstract data types

34.

Differentiate Concrete data type and abstract datatype?

Answer»

Concrete data type:

1. A concrete data type is a data type whose representation is known.

2. Concrete data types or structures (CDT’s) are direct implementations of a relatively simple concept.

Abstract data type:

1. Abstract data type the representation of a data type is unknown.

2. Abstract Data Types (ADT’s) offer a high level view (and use) of a concept independent of its implementation.

35.

What is abstract data type?

Answer»

Abstract Data type (ADT) is a type (or class) for objects whose behavior is defined by a set of value and a set of operations. The definition of ADT only mentions what operations are to be performed but not how these operations will be implemented.

36.

How many types of functions are needed to facilitate abstraction?(a) 1(b) 2(c) 3(d) 4

Answer»

2  types of functions are needed to facilitate abstraction

37.

What are the two ways of representing the pair data type?

Answer»

Two ways of representing the pair data type. The first way is using List construct and the second way to implement pairs is with the tuple construct.