wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

StackLeague Quest II

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

Which term describes the mechanism of a function calling itself ?

a)

encapsulation

b)

inheritance

c)

recursion

d)

polymorphism

2.

In many programming languages, ‘otherwise’ and ‘else’ are part of which building block

a)

loop

b)

counter

c)

selection

d)

list structure

3.

(In most programming languages), which statement would be used in the definition of a function, to indicate the resulting value when this function is called?

a)

result = x

b)

reply x

c)

send x

d)

return x

4.

In the code snippet below identify the output

a)

StackLeague

StackLeague

StackLeague

b)

none

c)

StackLeague

d)

StackLeague

StackLeague

5.

In the code snippet below identify the output

a)

StackLeague

b)

StackLeague

StackLeague

c)

Error

d)

StackLeague

StackLeague

StackLeague

6.

Program which is written originally by the programmer is classified as

a)

Object code

b)

Machine code

c)

Source code

d)

Interactive programs

7.

When divisions of decimals are involved in a program, these numbers are stored in

a)

Rational Numbers

b)

Irrational Numbers

c)

Real Numbers

d)

Original Numbers

8.

Data types are differed on the basis of

a)

the way of storage

b)

the type of operations

c)

the type of operators used

d)

both a and b

9.

What is the special character that matches zero or more characters?

a)

^

b)

#

c)

-

d)

*

10.

How do you match the string “StackLeague” appearing at the beginning of a line?

a)

$StackLeague

b)

^StackLeague

c)

#StackLeague

d)

-StackLeague

11.

What does the regular expression [a-z] match?

a)

The characters a and z only

b)

All characters between the ranges a to z and A to Z

c)

All characters between the range a to z

d)

All characters between the range a to b

12.

Which of the following matches any space, tab, or newline?

a)

\s

b)

\b

c)

$

d)

\w

13.

How do you match the word “StackLeague” appearing at the beginning of a line?

a)

^StackLeague\d

b)

^StackLeague\b

c)

^StackLeague\w

d)

^StackLeague\n

14.

Which of these will match the strings station, stationary, and stationaries?

a)

station[a-z]?

b)

station[a-z]*

c)

station[a-z]+

d)

none of the above

15.

What regular expression matches the strings mouse or pig?

a)

mouse|pig

b)

mouse,pig

c)

mouse | pig

d)

mouse ^ pig

16.

What regular expression matches the whole words mouse or pig?

a)

\bmouse|pig\b

b)

\bmouse\b | \bpig\b

c)

\bmouse\b|\bpig\b

d)

\bmouse\w|\bpig\b

17.

What do we put after a character to match strings where that character appears two to four times in sequence?

a)

{2,4}

b)

{2-4}

c)

[2,4]

d)

[2-4]

18.

The regular expression \d{4} will match what?

a)

Any four character sequence

b)

Any four digit sequence

c)

The letter d four times

d)

The digit four times

19.

If brackets are used to define a group, what would match the regular expression (,\s[0-9]{1,4}){4},\s[0-9]{1,3}\.[0-9]?

a)

, 135, 1155, 915, 513, 18.8

b)

, 135, 11557, 915, 513, 18.8

c)

, 135, 1155, 915, 513, 188

d)

, 135, 1155, 915, 51, 188

20.

How many passes does an insertion sort algorithm consist of?

a)

N

b)

N-1

c)

N+1

d)

N^2

21.

What is the average case running time of an insertion sort algorithm?

a)

O(N)

b)

O(N log N)

c)

O(log N)

d)

O(N^2)

22.

Which of the following is not an advantage of optimized bubble sort over other sorting techniques in case of sorted elements?

a)

It is faster

b)

Consumes less memory

c)

Detects whether the input is already sorted

d)

Consumes less time

23.

The given array is arr = {1, 2, 4, 3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array?

a)

4

b)

2

c)

1

d)

0

24.

Depth First Search is equivalent to which of the traversal in the Binary Trees?

a)

Pre-order Traversal

b)

Post-order Traversal

c)

Level-order Traversal

d)

In-order Traversal

25.

The Data structure used in standard implementation of Breadth First Search is?

a)

Stack

b)

Queue

c)

Linked List

d)

Tree

26.

Which of the following problems can’t be solved using recursion?

a)

Factorial of a number

b)

Nth fibonacci number

c)

Length of a string

d)

Problems without base case

27.

Recursion is similar to which of the following?

a)

Switch Case

b)

Loop

c)

If-else

d)

if elif else

28.

In recursion, the condition for which the function will stop calling itself is ____________

a)

Best case

b)

Worst case

c)

Base case

d)

There is no such condition

29.

From the following sorting algorithms which has the lowest worst case complexity?

a)

Bubble sort

b)

Quick sort

c)

Merge sort

d)

Selection sort

30.

A binary search tree whose left subtree and right subtree differ in height by at most 1 unit is called?

a)

AVL tree

b)

Red Black Tree

c)

Lemma Tree

d)

None of the above

31.

Which of the following is a valid variable declaration

a)

cow_name

b)

cow.name

c)

cow name

d)

3cowname

32.

In the following expression q = x + y , x and y are called:

a)

Operators

b)

Values

c)

Operands

d)

Literals

33.

In the following expression q = x + y , + is called:

a)

Operators

b)

Values

c)

Operands

d)

Literals

34.

Which operators are used to test the relationship between two variables or between a variable and a constant?

a)

Arithmetic Operators

b)

Logical Operators

c)

Relational Operators

d)

Special Operators

35.

Which of the following is a logical operator?

a)

-

b)

%

c)

AND

d)

>

36.

If an expression contains an addition operator , multiplication operator and a subtraction operator, which operator has a higher priority when evaluating the expression?

a)

Addition Operator

b)

Multiplication Operator

c)

Subtraction Operator

d)

Whichever comes first

37.

Which of the following is a relational operator?

a)

>

b)

%

c)

*

d)

OR

38.

Which of the following converts source code into machine code at each runtime?

a)

linker

b)

compiler

c)

interpreter

d)

object encoder

39.

Assuming that + and * are arithmetic operators (addition and multiplication), to what does the expression 2 + 4 * 5 + 1 evaluate?

a)

36

b)

31

c)

23

d)

26

40.

Assuming that = and / are the assignment and division operators, what will be the outcome of the following code in most programming languages:


x = 3

y = 7

z = x / (y-7)

a)

runtime error

b)

syntax error

c)

logic error

d)

compiler error