TEST - 2 15-11-2024 - Questions & Answers
TEST - 2 15-11-2024 - Questions & Answers
Sample Input 2:
Move##hash##tofront
Sample Output 2:
####Movehashtofront
Sample Input 3:
###abcdef##
Sample Output 3:
#####abcdef
Constraints:
-
For example:
Language java
1 import java.util.*;
2
3 ▼ public class Main{
4▼ public static void main(String[] args){
5 Scanner in = new Scanner(System.in);
6 String s = in.next();
7 String res = moveHash(s);
8 System.out.println(res);
9 }
10 ▼ public static String moveHash(String s){
11 char[] arr = s.toCharArray();
12 int count = 0;
13 StringBuilder sb = new StringBuilder();
14
15 ▼ for (char c: arr){
16 if (c=='#')
17 count++;
18 }
19 while (count-- > 0)
20 sb.append('#');
21
22 for (char c: arr)
23 if (c != '#')
24 sb.append(c);
25
26 return sb.toString();
27 }
28 }
Test Input
Correct
Marks for this submission: 20.00/20.00.
Response history
Step Time Action State Marks
Question 2 Determine the candidate key for the given relation and related functional
Correct dependencies. Given: Relation R = {A, B, C, D, E, F} Functional Dependencies: C
Mark 1.00 out of → F, E → A, EC → D, A → B
1.00
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
a. 120
b. 87
c. 127
d. 27
e. 187
Response history
Step Time Action State Marks
b. None
c. Infinite loop
Response history
Step Time Action State Marks
Question 6 Identify the highest normal form of relation R(k, l, m, n) with functional
Incorrect dependencies: f{k → m, l → n}
Mark 0.00 out of
1.00 Select one:
Flag
1. 2NF
question
2. BCNF
Edit
question 3. 1NF
v1 (latest) 4. 3NF
Response history
Step Time Action State Marks
a. 490560
b. None
c. 49056
d. 490563
e. 490561
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
c. Error
d. Infinite loop
Response history
Step Time Action State Marks
a. Infinite loop
b. HaiHai
c. Hai
d. None
Response history
Step Time Action State Marks
Question 11 Which of the following data structures can be used to implement a priority
Correct queue?
Mark 1.00 out of
1.00 Select one:
Flag
1. Stack
question
2. Queue
Edit
question 3. Heap
v1 (latest) 4. Linked list
Response history
Step Time Action State Marks
Edit
3. Hub
question 4. Repeater
v1 (latest)
Response history
Step Time Action State Marks
c. 3
d. 3 1
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
Edit
3. None of the mentioned options
question 4. -*ddvw
v1 (latest)
Response history
Step Time Action State Marks
b. None
c. inside if block
Response history
Step Time Action State Marks
a. case 2 executed
b. case 1 executed
Response history
Step Time Action State Marks
a. Loop
b. 1
c. Null
e. 0
Response history
Step Time Action State Marks
Question 19 Which of the following checks the cloud service control, verifies adherence to
Incorrect standards, and examines areas such as privacy and performance levels?
Mark 0.00 out of
1.00 Select one:
Flag
1. Cloud carrier
question
2. Load dispatcher
Edit
question 3. Monitor of services
v1 (latest) 4. Cloud auditor
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
Question 21 Repeaters work on which of the following layers of the OSI model?
Correct
Edit
3. Network layer
question 4. Data link layer
v1 (latest)
Response history
Step Time Action State Marks
Question 22 Which of the following statements is/are correct about the adjacency matrix?
Correct 1=> The adjacency matrix for an undirected graph is always symmetric. 2=>
Mark 1.00 out of The adjacency matrix is also used to represent weighted graphs.
1.00
Response history
Step Time Action State Marks
a. Line 6
b. Line 4
c. no error
d. Line 7
e. Line 9
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
Question 25 Consider the following searching algorithms: 1=> Binary search 2=>
Incorrect Exponential binary search Which of the above searching techniques can be
Mark 0.00 out of used to perform unbounded searches?
1.00
Response history
Step Time Action State Marks
Question 26 Which of the following are the fundamental constraints that cloud
Correct infrastructure should implement? 1=> Transparency 2=> Scalability 3=> Security
Mark 1.00 out of
1.00 Select one:
Flag
1. 1 & 2
question
2. 1 & 3
Edit
question 3. 1, 2 & 3
v1 (latest) 4. 2 & 3
Response history
Step Time Action State Marks
a. 72
b. 78
c. 68
d. 56
e. 62
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
Question 29 Which of the following is a system that accepts service requests and allocates
Correct virtual machines as required?
Mark 1.00 out of
1.00 Select one:
Flag 1. Cloud carrier
question
2. Monitor of services
Edit
question 3. Load dispatcher
v1 (latest) 4. Cloud auditor
Response history
Step Time Action State Marks
Question 30 In which type of graph, there is a cycle in which each vertex is visited only once
Correct and no edge is visited more than once?
Mark 1.00 out of
1.00 Select one:
Flag
1. Bipartite graph
question
2. Directed graph
Edit
question 3. Hamiltonian cycle
v1 (latest) 4. Eulerian graph
Response history
Step Time Action State Marks
Question 31 Write an essay on 'How the Internet Has Changed the World.'
Correct
Your essay should consist of a minimum of three paragraphs: the first should
Mark 50.00 out
serve as the introduction, the second should comprise the body, and the third
of 50.00
should act as the conclusion.
Flag
question The essay must contain a minimum of 200 words and a maximum of 250
Edit
words.
question
v2 (latest)
The internet has completely transformed the world in many ways. It
has made communication faster and easier, connecting people from
different parts of the world instantly. Through social media, emails and
video calls, families and friends can stay in touch no matter the
distance. Businesses can now operate globally, making it easier for
people to work from home, collaborate, and share ideas with
colleagues around the world. The internet has also allowed people to
access information quickly, making learning and education more
accessible to anyone with a connection.
M count: 212
Word h i h h d h h dd b i
Response history
Step Time Action State Marks
Question 32 Consider the following searching algorithms: 1=> Interpolation search 2=>
Incorrect Binary search Which of the above searching techniques works better if the
Mark 0.00 out of array is sorted and uniformly distributed?
1.00
Response history
Step Time Action State Marks
Question 33 In the context of stacks, what is the term used for removing an element from a
Correct stack?
Mark 1.00 out of
1.00 Select one:
Flag
1. Remove
question
2. Extract
Edit
question 3. Pop
v1 (latest) 4. Push
Response history
Step Time Action State Marks
Question 34 Consider a binary heap in which the value in a parent node is greater than the
Correct values in its two children nodes. What is such a binary heap called?
Mark 1.00 out of
1.00 Select one:
Flag
1. Max heap
question
2. Unique heap
Edit
question 3. None of the mentioned options
v1 (latest) 4. Min heap
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
Question 36 In which layer of the OSI model does encryption typically occur?
Incorrect
Edit
3. Session layer
question 4. Data Link layer
v1 (latest)
Response history
Step Time Action State Marks
Response history
Step Time Action State Marks
a. 4
b. 0
c. 1
d. 3
e. 2
Response history
Step Time Action State Marks
Question 39 Which of the following array representations represent a strict but not complete
Correct binary tree?
Mark 1.00 out of
1.00 Select one:
Flag 1. A, B, C, D, E
question
2. A, B, C, D, E, F, G
Edit
question 3. None of the mentioned options
v1 (latest) 4. A, B, C, _, _, D, E
Response history
Step Time Action State Marks
Question 40
Correct
Problem Statement:
Mark 20.00 out Given a string with consecutive repeated characters, you are tasked with
of 20.00 compressing the string such that each consecutive character sequence is
Flag replaced by the character followed by the count of its occurrences. If a
question character appears only once consecutively, it should be retained without any
Edit count. Objective: Write a program that compresses a string by reducing
question consecutive repeated characters into the character followed by the count of
v2 (latest) repetitions. Input: A string s consisting of lowercase alphabets (a-z). Output: A
compressed version of the string, where each consecutive character is
followed by its count if it appears more than once consecutively, or just the
character itself if it appears only once.
Sample TestCases:
Sample Input 1:
aabbbbeeeeffggg
Sample Output 1:
a2b4e4f2g3
Sample Input 2:
abbccccc
Sample Output 2:
ab2c5
Sample Input 3:
abcd
Sample Output 3:
abcd
Constraints:
-
For example:
Language java
1 import java.util.*;
2
3 ▼ public class Main{
4▼ public static void main(String[] args) {
5 Scanner in = new Scanner(System.in);
6
7 String s = in.next();
8 String compressed = compress(s);
9 System.out.println(compressed);
10 }
11 ▼ public static String compress(String s){
12 StringBuilder sb = new StringBuilder();
13 int n = s.length(), count = 0;
14 ▼ for (int i = 0; i < n;) {
15 final char c = s.charAt(i);
16 count = 0;
17 ▼ while (i < n && s.charAt(i)==c) {
18 i++; count++;
19 }
20 sb.append(c);
21 ▼ if (count > 1) {
22 sb.append(count);
23 }
24 }
25
26 return sb.toString();
27 }
28 }
Correct
Marks for this submission: 20.00/20.00.
Response history
Step Time Action State Marks
Question 41 Consider two arrays, A and B: A = {1, 3, 5} B = {2, 0} A new array is formed by
Correct joining the two arrays. Sorting is done on the new array. What will be the
Mark 1.00 out of second-to-last element in the new array?
1.00
Response history
Step Time Action State Marks
Question 42 Which of the following are the main functions of a stack? 1=> Push 2=> Pop
Correct 3=> Peek
Mark 1.00 out of
1.00 Select one:
Flag
1. 1 & 2
question
2. 1, 2 & 3
Edit
question 3. 2 & 3
v1 (latest) 4. 1 only
Response history
Step Time Action State Marks
c. 1
d. 26
Response history
Step Time Action State Marks
Edit
3. The number of nodes in a full binary tree may be even or odd
question 4. The number of nodes in a full binary tree is always odd
v1 (latest)
The correct answer is: The number of nodes in a full binary tree may be even or
odd
Response history
Step Time Action State Marks
a. Char 65
c. Integer 65
d. Bye
Response history
Step Time Action State Marks
Edit
3. Data integrity problem
question 4. Data security problem
v1 (latest)
Response history
Step Time Action State Marks
Question 47 Which of the following statements is correct for routers? 1=> It manages traffic
Correct between networks by forwarding data packets to their intended IP addresses.
Mark 1.00 out of 2=> It allows multiple devices to use the same Internet connection. 3=> It
1.00 manages traffic between networks and devices by forwarding data packets to
Flag their intended MAC addresses.
question
Response history
Step Time Action State Marks
Question 48 Which of the following protocols is used for routing in the Internet?
Correct
Edit
3. ICMP
question 4. FTP
v1 (latest)
Response history
Step Time Action State Marks
Question 49 James is using heap sort to sort an array in increasing order. What is the overall
Correct time complexity of the sorting technique used by him?
Mark 1.00 out of
1.00 Select one:
Flag
1. logn
question
2. n²
Edit
question 3. nlogn
v1 (latest) 4. O
Response history
Step Time Action State Marks
Question 50 Consider an array R containing some number of elements. While sorting the
Correct array R using count sort, an array named C is used to store the frequencies of
Mark 1.00 out of the elements. What is the space complexity of the count sort algorithm in this
1.00 case?
Flag
question Select one:
Edit
1. O
question
v1 (latest) 2. O(log n)
3. O(n²)
4. O(1)
Response history
Step Time Action State Marks
Question 51 Suppose there is a 1-D array Arr[20] with the lower bound as 1 and starting
Correct base address as 60. Find the address of Arr[3] if the size of each element is 4.
Mark 1.00 out of
1.00 Select one:
Flag
1. 63
question
2. 72
Edit
question 3. 68
v1 (latest) 4. 64
Response history
Step Time Action State Marks
a. Loop
b. LoopLoopLoopLoopLoop
c. No output
d. LoopLoopLoopLoop
e. None
Response history
Step Time Action State Marks
Question 53 Which of the following statements is correct regarding the enqueue operation
Correct in a queue?
Mark 1.00 out of
1.00 Select one:
Flag
1. It is the operation to remove an element from the front of the queue.
question
2. It adds an element at the front of the queue.
Edit
question 3. It is the operation to add an element at the end of the queue.
v1 (latest) 4. None of the above
The correct answer is: It is the operation to add an element at the end of the
queue.
Response history
Step Time Action State Marks
Finish review