NEW
Font size
WorksheetsStackLeague Quest II
Total questions: 40
Worksheet time: 20mins
Which term describes the mechanism of a function calling itself ?
encapsulation
inheritance
recursion
polymorphism
In many programming languages, ‘otherwise’ and ‘else’ are part of which building block
loop
counter
selection
list structure
(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?
result = x
reply x
send x
return x
In the code snippet below identify the output
StackLeague
StackLeague
StackLeague
none
StackLeague
StackLeague
StackLeague
In the code snippet below identify the output
StackLeague
StackLeague
StackLeague
Error
StackLeague
StackLeague
StackLeague
Program which is written originally by the programmer is classified as
Object code
Machine code
Source code
Interactive programs
When divisions of decimals are involved in a program, these numbers are stored in
Rational Numbers
Irrational Numbers
Real Numbers
Original Numbers
Data types are differed on the basis of
the way of storage
the type of operations
the type of operators used
both a and b
What is the special character that matches zero or more characters?
^
#
-
*
How do you match the string “StackLeague” appearing at the beginning of a line?
$StackLeague
^StackLeague
#StackLeague
-StackLeague
What does the regular expression [a-z] match?
The characters a and z only
All characters between the ranges a to z and A to Z
All characters between the range a to z
All characters between the range a to b
Which of the following matches any space, tab, or newline?
\s
\b
$
\w
How do you match the word “StackLeague” appearing at the beginning of a line?
^StackLeague\d
^StackLeague\b
^StackLeague\w
^StackLeague\n
Which of these will match the strings station, stationary, and stationaries?
station[a-z]?
station[a-z]*
station[a-z]+
none of the above
What regular expression matches the strings mouse or pig?
mouse|pig
mouse,pig
mouse | pig
mouse ^ pig
What regular expression matches the whole words mouse or pig?
\bmouse|pig\b
\bmouse\b | \bpig\b
\bmouse\b|\bpig\b
\bmouse\w|\bpig\b
What do we put after a character to match strings where that character appears two to four times in sequence?
{2,4}
{2-4}
[2,4]
[2-4]
The regular expression \d{4} will match what?
Any four character sequence
Any four digit sequence
The letter d four times
The digit four times
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]?
, 135, 1155, 915, 513, 18.8
, 135, 11557, 915, 513, 18.8
, 135, 1155, 915, 513, 188
, 135, 1155, 915, 51, 188
How many passes does an insertion sort algorithm consist of?
N
N-1
N+1
N^2
What is the average case running time of an insertion sort algorithm?
O(N)
O(N log N)
O(log N)
O(N^2)
Which of the following is not an advantage of optimized bubble sort over other sorting techniques in case of sorted elements?
It is faster
Consumes less memory
Detects whether the input is already sorted
Consumes less time
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?
4
2
1
0
Depth First Search is equivalent to which of the traversal in the Binary Trees?
Pre-order Traversal
Post-order Traversal
Level-order Traversal
In-order Traversal
The Data structure used in standard implementation of Breadth First Search is?
Stack
Queue
Linked List
Tree
Which of the following problems can’t be solved using recursion?
Factorial of a number
Nth fibonacci number
Length of a string
Problems without base case
Recursion is similar to which of the following?
Switch Case
Loop
If-else
if elif else
In recursion, the condition for which the function will stop calling itself is ____________
Best case
Worst case
Base case
There is no such condition
From the following sorting algorithms which has the lowest worst case complexity?
Bubble sort
Quick sort
Merge sort
Selection sort
A binary search tree whose left subtree and right subtree differ in height by at most 1 unit is called?
AVL tree
Red Black Tree
Lemma Tree
None of the above
Which of the following is a valid variable declaration
cow_name
cow.name
cow name
3cowname
In the following expression q = x + y , x and y are called:
Operators
Values
Operands
Literals
In the following expression q = x + y , + is called:
Operators
Values
Operands
Literals
Which operators are used to test the relationship between two variables or between a variable and a constant?
Arithmetic Operators
Logical Operators
Relational Operators
Special Operators
Which of the following is a logical operator?
-
%
AND
>
If an expression contains an addition operator , multiplication operator and a subtraction operator, which operator has a higher priority when evaluating the expression?
Addition Operator
Multiplication Operator
Subtraction Operator
Whichever comes first
Which of the following is a relational operator?
>
%
*
OR
Which of the following converts source code into machine code at each runtime?
linker
compiler
interpreter
object encoder
Assuming that + and * are arithmetic operators (addition and multiplication), to what does the expression 2 + 4 * 5 + 1 evaluate?
36
31
23
26
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)
runtime error
syntax error
logic error
compiler error
