question stringlengths 10 5.93k | optA stringlengths 0 516 | optB stringlengths 0 699 | optC stringlengths 0 575 | optD stringlengths 0 631 | answer stringclasses 4
values | dataset stringclasses 1
value |
|---|---|---|---|---|---|---|
Question: What is the output of the following code?
i=0;for i=0:2
i=1; end | Output is suppressed | Output shows 1 3 times | Output shows 1 2 times | Error | A | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: Given an m x n matrix, return a new matrix answer where answer[row][col] is the rank of matrix[row][col]. The rank is an integer that represen... | maxRankSoFar = [0] * (m + n) | maxRankSoFar = [0 for _ in range(m + n)] | maxRankSoFar = [[] for _ in range(m + n)]
maxRankSoFar = [len(i) for i in maxRankSoFar] | maxRankSoFar = [0] * len(matrix) | A | tuandunghcmut_coding_mcqa_train |
Question: The number of bits used for addressing in Gigabit Ethernet is __________. | 32 bit | 48 bit | 64 bit | 128 bit | B | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: You are given an integer array nums. A number x is lonely when it appears only once, and no adjacent numbers (i.e. x + 1 and x - 1) appear in ... | num - 1 not in count and | count.get(num - 1, 0) == 0 and | count[num - 1] == 0 and | not count.get(num - 1, False) and | C | tuandunghcmut_coding_mcqa_train |
Question: The directory can be viewed as ________ that translates filenames into their directory entries | Symbol table | Partition | Swap space | Cache | A | tuandunghcmut_coding_mcqa_train |
Question: Which solution below is the most likely completion the following
code snippet to achieve the desired goal?
def choose_num(x, y):
"""This function takes two positive numbers x and y and returns the
biggest even integer number that is in the range [x, y] inclusive. If
there's no such number, then... | if x > y:
return -1
if y % 2 == 0:
return y
return y - 1 | if x > y:
return -1
if y % 2 == 0:
return y
if x == y:
return -1
return y - 1
| for i in range(x, y):
if i % 2 == 0:
return i
return -1 | if x > y:
return -1
else:
return x | B | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int n,m,v,p;
static int a[];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt... | Internal error | Compile Error | Runtime Error | Time Limit Exceeded | C | tuandunghcmut_coding_mcqa_train |
Question: Sum of first 3 consecutive numbers in an AP is 51 and product of the first and last number is 288. Find the numbers. | 17, 18 and 19 | 16, 17 and 18 | 15, 16 and 17 | None of the above | B | tuandunghcmut_coding_mcqa_train |
Question: What will be the output of the following Python code?
>>>names = ['Amir', 'Bear', 'Charlton', 'Daman']>>>print(names[-1][-1]) | A | Daman | Error | n | D | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: The set [1, 2, 3, ..., n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, we get the fol... | fact = [1] * (n + 1) | fact = list(1 for _ in range(n+1)) | fact = [1]*(n+1) | fact = [1 for _ in range(n+1)] | A | tuandunghcmut_coding_mcqa_train |
Question: Which of the following is the correct use of useLayoutEffect ? | Optimize for all devices | Complete all the update | Change the layout | Paint before the effect runs | D | tuandunghcmut_coding_mcqa_train |
Question: The value of a string variable can be surrounded by single quotes. | True | False | Both previous answers are correct | None of the previous answers are correct | A | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
n = int(input())
p = 10**9 + 7
def fact(n):
n_ = 1
yield n_
for i in range(1, n+1):
n_ = (n_*i) % p
yield n_
ans = 0
m = n - 1
f = list(fact(m))
perm = 0
for k in range((n+1)//2, n):
b = m - k... | Internal error | Time Limit Exceeded | Compile Error | Runtime Error | B | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] a... | Compile Error | Time Limit Exceeded | Runtime Error | No abnormally found | B | tuandunghcmut_coding_mcqa_train |
Question: At what stage form of data can be gathered in a react app? | Before the form is submitted | After the form is submitted | While the form is being filled | Before form filling starts | C | tuandunghcmut_coding_mcqa_train |
Question: What will be the output of the following JavaScript statement?
var grand_Total=eval("10*10+5"); | 10*10+5 | 105 as a string | 105 as an integer value | Exception is thrown | C | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
X,K,D = map(int,input().split())
X = abs(X)
X_div_D = X//D
ans_min = X % D
if K <= X_div_D:
print(X - K * D)
else:
if (K % 2) ^ (X_div_D % 2) == 0:
print(ans_min)
else:
print(abs(ans_min - D)) | Time Limit Exceeded | Memory Limit Exceeded | Compile Error | No abnormally found | D | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: You are given a string word and an integer k. We consider word to be k-special if |freq(word[i]) - freq(word[j])| <= k for all indices i and j... | deletions += max(0, freq - (minFreq - k)) | deletions += max(0, freq - minFreq - k) | deletions += max(0, freq - (minFreq + k)) | deletions += max(0, freq - (k - minFreq)) | C | tuandunghcmut_coding_mcqa_train |
Question: The NOT NULL constraint enforces a column to not accept NULL values. | True | False | Both previous answers are correct | None of the previous answers are correct | A | tuandunghcmut_coding_mcqa_train |
Question: Which solution below is the most likely completion the following
code snippet to achieve the desired goal?
def by_length(arr):
"""
Given an array of integers, sort the integers that are between 1 and 9 inclusive,
reverse the resulting array, and then replace each digit by its corresponding name ... | dic = {
1: "One",
2: "Two",
3: "Three",
4: "Four",
5: "Five",
6: "Six",
7: "Seven",
8: "Eight",
9: "Nine",
}
sorted_arr = sorted(arr, reverse=True)
new_arr = []
for var in sorted_arr:
try:
new_arr.append(dic[... | dic = {
1: "One",
2: "Two",
3: "Three",
4: "Four",
5: "Five",
6: "Six",
7: "Seven",
8: "Eight",
9: "Nine",
}
sorted_arr = sorted(arr, reverse=True)
new_arr = []
for var in sorted_arr:
try:
new_arr.append(dic[... | dic = {
1: "One",
2: "Two",
3: "Three",
4: "Four",
5: "Five",
6: "Six",
7: "Seven",
8: "Eight",
9: "Nine",
}
sorted_arr = sorted(arr, reverse=True)
new_arr = []
for var in sorted_arr:
try:
new_arr.append(dic[... | dic = {
1: "One",
2: "Two",
3: "Three",
4: "Four",
5: "Five",
6: "Six",
7: "Seven",
8: "Eight",
9: "Nine",
}
sorted_arr = sorted(arr)
new_arr = []
for var in sorted_arr:
try:
new_arr.append(dic[var])
... | C | tuandunghcmut_coding_mcqa_train |
Question: Which is the Bit Toggling operator below.? | Bitwise OR operator( | ) | Bitwise XOR Operator (^) | Bitwise AND Operator(&) | TILDE operator(~) | D | tuandunghcmut_coding_mcqa_train |
Question: Which of the following statements are true ? (a) Three broad categories of Networks are Circuit Switched Networks Packet Switched Networks Message Switched Networks (b) Circuit Switched Network resources need not be reserved during the set up phase. (c) In packet switching there is no resource allocation fo... | (a) and (b) only | (b) and (c) only | (a) and (c) only | (a), (b) and (c) | C | tuandunghcmut_coding_mcqa_train |
Question: What is the size of the smallest MIS(Maximal Independent Set) of a chain of nine nodes? | 5 | 4 | 3 | 2 | C | tuandunghcmut_coding_mcqa_train |
Question: Consider a computer network using the distance vector routing algorithm in its network layer. The partial topology of the network is shown below.
The objective is to find the shortest-cost path from the router R to routers P and Q. Assume that R does not initially know the shortest routes to P and Q. Assum... | The distance from R to P will be stored as 10 | The distance from R to Q will be stored as 7 | The next hop router for a packet from R to P is Y | The next hop router for a packet from R to Q is Z | C | tuandunghcmut_coding_mcqa_train |
Question: In the context of encapsulation, what is the significance of the single leading underscore in attribute names? | It indicates a read-only attribute. | It signifies a protected attribute. | It is used for name mangling. | It is a convention to indicate internal use. | D | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main{
public static void main (String[] args){
Scanner sc = new Scanner (System.in);
int N = sc.nextInt();
int T = sc.nextInt();
Integer c[] = new In... | Compile Error | No abnormally found | Memory Limit Exceeded | Runtime Error | D | tuandunghcmut_coding_mcqa_train |
Question: Which part of the Virtual DOM architecture is responsible for applying the changes identified during the "diffing" process to the real DOM? | Reconciliation | Patching | Rendering | Diffing | A | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] min = new int [a];
int [] max = new int [a];
for(int i=0;i<a... | Compile Error | Time Limit Exceeded | Runtime Error | Memory Limit Exceeded | A | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: You have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes. Given an integer n, return the number of w... | dp[i] = dp[i - 1] + 2 * dp[i - 2] | dp[i] = 3 * dp[i - 1] - dp[i - 3] | dp[i] = 2 * dp[i - 1] + dp[i - 3] | dp[i] = dp[i - 1] + dp[i - 2] | C | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to mo... | dp[i][j] = dp[i - 1][j] + dp[i][j - 1] | dp[i][j] = dp[i - 1][j] - dp[i][j - 1] | dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) | dp[i][j] = dp[i - 1][j] * dp[i][j - 1] | A | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original ... | prefix = sum([prefix, root.val]) | prefix += root.val | prefix += (root.val) | prefix = prefix + root.val | B | tuandunghcmut_coding_mcqa_train |
Question: How do you make each word in a text start with a capital letter? | You can't do that with CSS | transform:capitalize | text-style:capitalize | text-transform:capitalize | D | tuandunghcmut_coding_mcqa_train |
Question: Bootstrap 3 is mobile-first. | True | False | Both previous answers are correct | None of the previous answers are correct | A | tuandunghcmut_coding_mcqa_train |
Question: Which one of the following is NOT performed during compilation? | Dynamic memory allocation | Type checking | Symbol table management | Inline expansion | A | tuandunghcmut_coding_mcqa_train |
Question: How does cache simulation impact Load Testing scenarios? | It accelerates test execution by skipping cache-related checks | It has no impact on test scenarios | It simulates real-world scenarios by considering cache-related factors | It increases the number of virtual users | C | tuandunghcmut_coding_mcqa_train |
Question: How can you access a global variable from within a function in Python? | Use the access keyword | Use the global keyword | Use the outer keyword | Use the variable name directly | B | tuandunghcmut_coding_mcqa_train |
Question: Which of the following services is not provided by wireless access point in 802.11 WLAN ? | Association | Disassociation | Error correction | Integration | C | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] hoge = sc.nextLine("");
int temp = 0;
String str = "Good";
for(int i = 0; i < 4... | No abnormally found | Compile Error | Memory Limit Exceeded | Runtime Error | B | tuandunghcmut_coding_mcqa_train |
Question: When using the NumPy random module, how can you return a random number from 0 to 100?```
random
``` | random.rand(100) | random.randint(100) | random.rand() | None of the previous answers are correct | B | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: Given an array intervals where intervals[i] = [li, ri] represent the interval [li, ri), remove all intervals that are covered by another inter... | if prevEnd != end: | if end > prevEnd: | if prevEnd < end: | if not prevEnd >= end: | C | tuandunghcmut_coding_mcqa_train |
Question: Which solution below is the most likely completion the following
code snippet to achieve the desired goal?
def sorted_list_sum(lst):
"""Write a function that accepts a list of strings as a parameter,
deletes the strings that have odd lengths from it,
and returns the resulted list with a sorted o... | new_lst = []
for i in lst:
if len(i) % 2 != 0:
new_lst.append(i)
return sorted(new_lst, key=len) | lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len)
| lst.sort()
new_lst = []
for i in lst:
if len(i) % 2 != 0:
new_lst.append(i)
return sorted(new_lst, key=len) | lst.sort(key=len)
new_lst = []
for i in lst:
if len(i) % 2 == 0:
new_lst.append(i)
return new_lst | B | tuandunghcmut_coding_mcqa_train |
Question: Let R = ( A, B, C, D, E, F ) be a relation scheme with the following dependencies:
C→F, E→A, EC→D, A→B. Which of the following is a key of R? | CD | EC | AE | AC | B | tuandunghcmut_coding_mcqa_train |
Question: The implementation below is producing incorrect results.
Which solution below correctly identifies the bug and repairs it to achieve the desired goal?
1 import java.util.*;
2 import java.lang.*;
3 public class KNAPSACK {
4 public static int knapsack(int capacity, int [][] items) {
5 int weight =... | Modify line 8:
```for (int i = 1; i <= n; i++)``` | Modify line 18:
``` else if (weight <= j) {```
| Modify line 12:
```value = items[i - 1][1];``` | Modify line 14:
```for (int j = 0; j <= capacity; j++)``` | B | tuandunghcmut_coding_mcqa_train |
Question: What is the result of the following matrix subtraction?let matrix1 = [[1, 2], [3, 4]];let matrix2 = [[4, 3], [2, 1]];matrix1 - matrix2 | a) An error will be thrown | b) [[-3, -1], [1, 3]] | c) [[-3, -5], [1, 3]] | None of the previous answers are correct | A | tuandunghcmut_coding_mcqa_train |
Question: What is the output of this program?
#include<stdio.h> #include<sys/types.h> #include<sys/un.h> #include<sys/socket.h> int main() { struct sockaddr_un add_server, add_client; int fd_server, fd_client; int len; char ch; fd_server = socket(AF_UNIX,SOCK_STREAM,0); ... | this program will print the string “Sanfoundry” | segmentation fault | error | none of the mentioned | C | tuandunghcmut_coding_mcqa_train |
Question: What will be the output of the following C code?
#include <stdio.h> void f(char *k) { k++; k[2] = 'm'; } void main() { char s[] = "hello"; f(s); printf("%c\n", *s); } | h | e | m | o; | A | tuandunghcmut_coding_mcqa_train |
Question: A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I-type and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opco... | 14 | 15 | 16 | 12 | A | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
public class Main {
static int[][] map;
static int[][] directions8= {{... | Runtime Error | No abnormally found | Time Limit Exceeded | Memory Limit Exceeded | C | tuandunghcmut_coding_mcqa_train |
Question: #include <stdio.h>
int i;
int main() {
if (i) {
// Do nothing
} else {
printf("Else");
}
return 0;
}
``````C
What is correct about the above program? | if block is executed. | else block is executed. | It is unpredictable as i is not initialized. | Error: misplaced else | B | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
for i in range(Q):
B,C=map(int,input().split())
A = [C if i==B else i for i in A]
print(sum(A))
| Compile Error | Time Limit Exceeded | Internal error | Memory Limit Exceeded | B | tuandunghcmut_coding_mcqa_train |
Question: Purpose of \'Foreign Key\' in a table is to ensure | Null Integrity | Referential Integrity | Domain Integrity | Null and Domain Integrity | B | tuandunghcmut_coding_mcqa_train |
Question: Which Vue directive is used for list rendering? | v-bind | v-for | v-if | v-show | B | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: There are two types of persons: You are given a 0-indexed 2D integer array statements of size n x n that represents the statements made by n p... | dfs(good, i + 1, count + 1) | dfs(good, i * 2, count + 1) | dfs(good, i, count + 1) | dfs(good, i + 2, count + 1) | A | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.io.*;
import java.util.*;
import java.math.*;
// import java.awt.Point;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
long mod = 1_000_000_007;
long inf = Long.MAX_VAL... | No abnormally found | Memory Limit Exceeded | Internal error | Time Limit Exceeded | A | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] v = new int[N];
for (int i = 0; i < M;... | No abnormally found | Internal error | Compile Error | Time Limit Exceeded | A | tuandunghcmut_coding_mcqa_train |
Question: The following program fragment is written in a programming language that allows variables and does not allow nested declarations of functions.
global int i = 100, j = 5;
void P(x)
{
int i = 10;
print(x + 10);
i = 200;
j = 20;
print(x);
}
main()
{
P(i + j);
}
``````C
If the progra... | 115, 220 | 25, 220 | 25, 15 | 115, 105 | A | tuandunghcmut_coding_mcqa_train |
Question: What is the output of the given code?
a = 5
b=10
while a<b do
puts a*b
a+=2
b-=2
end | 5 10 | 50 56 | Infinite loop | 5 6 7 8 9 10 | D | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. Given an array nums, return the sum o... | return functools.reduce(lambda x, y: x | y, nums) << len(nums) - 1 | result = 0
for num in nums:
result ^= num
return result << len(nums) - 1 | def xor(a, b):
return a ^ b
return functools.reduce(xor, nums) << len(nums) - 1 | return functools.reduce(operator.or_, nums) << len(nums) - 1 | D | tuandunghcmut_coding_mcqa_train |
Question: What is the output of the following line of code?
Pie([1,2],[0,1,1]) | Error | Sliced pie chart | Pie-chart | Labelled Pie chart | A | tuandunghcmut_coding_mcqa_train |
Question: Which of the following statements is/are True?
P : C programming language has a weak type system with static types.
Q : Java programming language has a strong type system with static types.
Code: | P only | Q only | Both P and Q | Neither P nor Q | C | tuandunghcmut_coding_mcqa_train |
Question: In React.js which one of the following is used to create a class for Inheritance ? | Create | Extends | Inherits | Delete | B | tuandunghcmut_coding_mcqa_train |
Question: What is the equation of a simple linear regression line? | y=mx+b | y=ax2+bx+c | y=alog(x)+b | y=emx | A | tuandunghcmut_coding_mcqa_train |
Question: Which of the following is must for the API in React.js ? | SetinitialComponent | renderComponent | render | All of the above | B | tuandunghcmut_coding_mcqa_train |
Question: Suppose the adjacency relation of vertices in a graph is represented in a table Adj(X,Y). Which of the following queries cannot be expressed by a relational algebra expression of constant length? | List of all vertices adjacent to a given vertex | List all vertices which have self loops | List all vertices which belong to cycles of less than three vertices | List all vertices reachable from a given vertex | D | tuandunghcmut_coding_mcqa_train |
Question: Find the context of assigning a value from the below code snippets:
variable: var geeks = this. In TypeScript | printScope => console.log this | geek = this printScope -> console.log geek | printScope => console.log @ | All of the following | D | tuandunghcmut_coding_mcqa_train |
Question: What is a compilation? | Source code is converted to machine code and then to binary code after which the file is executed by the computer | Running through the source code line by line and executing each line one by one | Both a and b | None of the above | A | tuandunghcmut_coding_mcqa_train |
Question: Question 4: What is the output of the following program?
line = \"What will have so will\"
L = line.split(\'a\')
for i in L:
print(i, end=\' \')
``````Python3 | [‘What’, ‘will’, ‘have’, ‘so’, ‘will’] | Wh t will h ve so will | What will have so will | [‘Wh’, ‘t will h’, ‘ve so will’] | B | tuandunghcmut_coding_mcqa_train |
Question: Consider the set of relations given below and the SQL query that follows
Students : (Roll number, Name, Date of birth)
Courses: (Course number, Course name, instructor)
Grades: (Roll number, Course number, Grade)
SELECT DISTINCT Name
FROM Students, Courses, Grades
WHERE Students.Roll_number = Grades.Rol... | Names of Students who have got an A grade in all courses taught by Sriram | Names of Students who have got an A grade in all courses | Names of Students who have got an A grade in at least one of the courses taught by Sriram | None of the above | C | tuandunghcmut_coding_mcqa_train |
Question: What will be the output of the following PHP code?
<?php$var1 = 3;print $var = ++$var;?> | 1 | 0 | 2 | 3 | A | tuandunghcmut_coding_mcqa_train |
Question: An Ethernet frame that is less than the IEEE 802.3 minimum length of 64 octets is called | Short frame | Small frame | Mini frame | Runt frame | D | tuandunghcmut_coding_mcqa_train |
Question: Which solution below is the most likely completion the following
code snippet to achieve the desired goal?
def closest_integer(value):
'''
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers... | from math import floor, ceil
if value.count('.') == 1:
value = value.rstrip('0')
num = float(value)
if value[-2:] == '.5':
res = round(num)
else:
res = int(num)
else:
res = int(value)
return res | from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(valu... | from math import floor, ceil
if value.count('.') == 1:
value = value.rstrip('0')
num = float(value)
if value[-2:] == '.5':
res = ceil(num)
else:
res = round(num)
else:
res = int(value)
return res | from math import floor, ceil
if value.count('.') == 1:
value = value.rstrip('0')
num = float(value)
if num >= 0:
res = ceil(num)
else:
res = floor(num)
else:
res = int(value)
return res | B | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value ... | if self._isLeaf(root) and root.val == target: return None
return root | return root if not (self._isLeaf(root) and root.val == target) else None | return None if self._isLeaf(root) and root.val == target else root | None of the previous answers are correct | C | tuandunghcmut_coding_mcqa_train |
Question: Which of the following function is true about changing the state in React.js ? | this.State{} | this.setState | this.setChangeState | All of the above | B | tuandunghcmut_coding_mcqa_train |
Question: Which of the following FD can’t be implied from FD set: {A->B, A->BC, C->D} ? | A->C | B->D | BC->D | All of the above | B | tuandunghcmut_coding_mcqa_train |
Question: The time complexity of solving the 0-1 Knapsack Problem using dynamic programming with a bottom-up approach (tabulation) is: | O(n) | O(n log n) | O(n * capacity) | O(n * capacity^2) | C | tuandunghcmut_coding_mcqa_train |
Question: Which one of the following statements, related to the requirements phase in Software Engineering, is incorrect? | “Requirement validation” is one of the activities in the requirements phase. | “Prototyping” is one of the methods for requirement analysis. | “Modelling-oriented approach” is one of the methods for specifying the functional specifications | “Function points” is one of the most commonly used size metric for requirements. | C | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
A , B = map ( int , input ( ) . split( ) )
if ( A<= 9 and B <= 9) :
print ( A * B )
else:
print ( -1 ) | Internal error | Runtime Error | No abnormally found | Compile Error | C | tuandunghcmut_coding_mcqa_train |
Question: How does heteroscedasticity impact the results of linear regression? | It inflates standard errors and can lead to incorrect inferences | It improves the precision of coefficient estimates | It has no impact on the regression results | It reduces bias in the model | A | tuandunghcmut_coding_mcqa_train |
Question: Which of the below method is used to return the current working directory of the process ? | cwd(); | cmd(); | pwd(); | None of the above | A | tuandunghcmut_coding_mcqa_train |
Question: Which solution below is the most likely completion the following
code snippet to achieve the desired goal?
def unique_digits(x):
"""Given a list of positive integers x. return a sorted list of all
elements that hasn't any even digit.
Note: Returned list should be sorted in increasing order.
... | odd_digit_elements = []
for i in x:
if any(int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements) | odd_digit_elements = []
for i in x:
if all(int(c) % 2 != 0 for c in str(i)):
odd_digit_elements.append(i)
return odd_digit_elements | odd_digit_elements = []
for i in x:
if all(int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements, reverse=True) | odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
| D | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
n = int(input())
a = sorted(map(int,input().split()))
while a[-2] != 0:
w = 10**9+1
for i in range(n):
a[i] %= w
if a[i]!=0 and w==10**9+1:
w = a[i]
a = sort... | Time Limit Exceeded | Runtime Error | Internal error | Compile Error | A | tuandunghcmut_coding_mcqa_train |
Question: When a 'watcher' runs, both the old and the new data property values are available as arguments to the watcher method. | Neither the old nor the new data property values are available | Only the new data property value is available | Only the old data property value is available | Yes | D | tuandunghcmut_coding_mcqa_train |
Question: Look at the problem below, the solution is missing a part, which option is the most likely to complete the solution and achieve the desired goal?
Problem description: Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours... | key=eatspeed(m) for eatspeed in [eatHours] | key=eatHours | key=lambda m: (m, eatHours(m))[1] | key=lambda m: eatHours(m)) + 1 | D | tuandunghcmut_coding_mcqa_train |
Question: What will be the output of the following C code?
#include <stdio.h> int const print() { printf("Hello World.com"); return 0; } void main() { print(); } | Error because function name cannot be preceded by const | Sanfoundry.com | Sanfoundry.com is printed infinite times | Blank screen, no output | A | tuandunghcmut_coding_mcqa_train |
Question: What will be the output of the following Java code?
class overload { int x; double y; void add(int a , int b) { x = a + b; } void add(double c , double d) { y = c + d; } overload() { this.x = 0; ... | 6 6 | 6.4 6.4 | 6.4 6 | 4 6.4 | D | tuandunghcmut_coding_mcqa_train |
Question: What is the output of this program?
#! /usr/bin/awk -f BEGIN { print index("hello_world","linux") } | sanfoundry linux | sanfoundry | 0 | none of the mentioned | C | tuandunghcmut_coding_mcqa_train |
Question: The implementation below is producing incorrect results.
Which solution below correctly identifies the bug and repairs it to achieve the desired goal?
1 import java.util.*;
2 public class GET_FACTORS {
3 public static ArrayList<Integer> get_factors(int n) {
4 if (n == 1) {
5 return n... | Modify line 15:
``` return new ArrayList<Integer>(Arrays.asList(n));```
| Modify line 8:
``` for (int i=2; i <= max; i++) {``` | Modify line 5:
```return new ArrayList<Integer>(Arrays.asList(n));``` | Modify line 4:
``` if (n <= 1) {``` | A | tuandunghcmut_coding_mcqa_train |
Question: Consider a B+-tree in which the maximum number of keys in a node is 5. What is the minimum number of keys in any non-root node? (GATE CS 2010) | 1 | 2 | 3 | 4 | B | tuandunghcmut_coding_mcqa_train |
Question: Consider any array representation of an n element binary heap where the elements are stored from index 1 to index n of the array. For the element stored at index i of the array (i <= n), the index of the parent is | i - 1 | floor(i/2) | ceiling(i/2) | (i+1)/2 | B | tuandunghcmut_coding_mcqa_train |
Question: How do you make an object from a class do something when it is created? | def __onmake__(self, [...]): | def __del__(self, [...]): | def __create__(self, [...]): | def __init__(self, [...]): | A | tuandunghcmut_coding_mcqa_train |
Question: What does the term "Boundary Value Analysis" refer to in software testing? | Testing at the boundaries of input values | Analyzing code complexity | Testing the boundary between different software components | Evaluating the user interface | A | tuandunghcmut_coding_mcqa_train |
Question: Which of the following is the pop() method does? | Display the first element | Decrements length by 1 | Increments length by 1 | None of the mentioned | B | tuandunghcmut_coding_mcqa_train |
Question: Which of the following command is used to delete a table in SQL? | delete | truncate | remove | drop | D | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
n, a, b = map(int, input().split())
mod = int(1e+9) + 7
def extgcd(a, b):
if b == 0:
return 1, 0
else:
x, y, u, v, k, l = 1, 0, 0, 1, a, b
while l != 0:
x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
... | Time Limit Exceeded | Memory Limit Exceeded | No abnormally found | Runtime Error | A | tuandunghcmut_coding_mcqa_train |
Question: What is Automation Testing? | Testing performed by humans manually | Testing performed using automated scripts | Testing performed only on mobile devices | Testing performed on the cloud | B | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import it... | Runtime Error | No abnormally found | Compile Error | Time Limit Exceeded | B | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
from collections import deque
def getPath(adj, start, goal):
q = deque()
q.appendleft((start, 0))
while len(q):
cur, p = q.pop()
if cur == goal:
return p
for nxt, nhop in adj[cur]... | Runtime Error | Compile Error | Internal error | No abnormally found | D | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
#ABC132 B
n = int(input())
P = list(map(int,input().split()))
K = 0
for i in range(n-2):
if (P[i] < P[i+1] and P[i+1] < P[i+2]) or (P[i+2] < P[i+1] and P[i+1] < P[i]):
K += 1
print(K) | Time Limit Exceeded | Internal error | No abnormally found | Memory Limit Exceeded | C | tuandunghcmut_coding_mcqa_train |
Question: Choose the correct statement for the following code segment?
bool check (int N)
{
if( N & (1 << i) )
return true;
else
return false;
} | function returns true if N is odd | function returns true if N is even | function returns true if ith bit of N is set | function returns false if ith bit of N is set | C | tuandunghcmut_coding_mcqa_train |
Question: Given a code snippet below, which behavior most likely to occur when execute it?
import java.util.Scanner;
public class taskA.java{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int A=sc.nextInt();
int B=sc.nextInt();
int C=sc.nextInt();
int maximum=A+(B*10+C);
System.out.println(m... | Compile Error | Internal error | Runtime Error | Memory Limit Exceeded | A | tuandunghcmut_coding_mcqa_train |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 81