
LogicMaster - Set I
Authored by Vani Agrawal
Computers
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
13 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following logic?
Take a number N as input.
If N is even, divide it by 2.
If N is odd, multiply it by 3 and add 1.
Repeat the process until N becomes 1.
What is the sequence if N = 7?
7 → 22 → 11 → 34 → 17 → 52 → 26 → 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
7 → 21 → 10 → 5 → 16 → 8 → 4 → 2 → 1
7 → 3 → 10 → 5 → 1
7 → 14 → 28 → 56 → 1
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If a number X is passed through the following steps:
1. Multiply by 3
2. Subtract 4
3. Divide by 2
4. Add 5
What is the output if X = 6?
11
12
13
14
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A program runs without errors but produces incorrect output in certain cases. What type of bug is this?
Syntax Error
Runtime Error
Logical Error
Compiler Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How to efficiently find the unique number in an array where every number appears twice except one?
Sort the array and check adjacent pairs
Use a hash table to store occurrences
Perform a bitwise XOR operation across all elements
Use two nested loops to compare each element
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
You are writing a function that sorts a nearly sorted array, where each element is at most 5 positions away from its correct place. What sorting algorithm will be the most efficient?
Quick Sort
Bubble Sort
Heap Sort
Insertion Sort
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
There are N people standing in a circle, and every k-th person is eliminated. The process continues until only one person remains. What is the best approach to solve this problem?
Brute force simulation
Recursion
Mathematical formula
Both (b) and (c)
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
int x = 5;
x = x++;
print(x);
What value of x will be printed?
5
6
7
8
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?