Coding question
Question 1: Find Missing Number in Array by c programming
Problem: You are given an array of n-1 integers in the range from 1 to n. There are no duplicates. One
number is missing. Find the missing number in O(n) time and O(1) space.
Question 2: Find the Majority Element in by c programming
Problem: Given an array of size n, find the majority element (an element that appears more than n/2 times).
Use the Boyer-Moore Voting Algorithm.
Question 3: Check if a Number is Power of Two by c programming
Problem: Write a program to check if a given number is a power of two.
Question 4: Swap Two Numbers Using Pointers by c programming
Problem: Swap two integers using pointers without using a third variable.
Question 5: Count Vowels in a String
Problem: Count the number of vowels in a string using a function.
Question 6: Implement a Simple Linked List and Print the List by c programming
Problem: Create a singly linked list, insert elements at the beginning, and print the list.
Question 7: Frequency Counter by python programming
Problem : Write a program to count the frequency of each character in a given string.
Question 8: Anagram Detection
problem: Check if two strings are anagrams of each other. Ignore spaces and punctuation.
Question 9:Insert second array into first array at specified index by python
Problem:
First array: 3 8 2 5 7 9 1 2 -3
Second array: 9 8 7
Index: 3
Output should be
3 8 2 9 8 7 5 7 9 1 2 -3
Question 10: Reverse String by python programming
Problem:Write a function reverse_words(s) that takes a string s as input and returns a new string where the
words are reversed but their order remains the same.
Input: "hello world"
Output: "olleh dlrow"
Input: "Python is fun"
Output: "nohtyP si nuf"
Input: "reverse the words"
Output: "esrever eht sdrow"
Question 11: Printing pattern by java programming
Problem:
23
*56
7 * 9 10
11 12 * 14 15
Question 12: Printing pattern by java programming
Problem:
1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
Question 13:
Problem: What will be the output of the following Java code?
public class Main {
public static void main(String[] args) {
int x = 10;
int y = 5;
x = x + y - (y = x - y);
[Link]("x = " + x + ", y = " + y);
Question 14:
Problem: What will be the output of the following Java code?
public class Main {
static int count;
static {
count = 10;
[Link]("Static block: count = " + count);
public static void main(String[] args) {
count++;
[Link]("Main method: count = " + count);
Question 15:
Problem:Write a Java program to reverse an integer without using any additional data structures like arrays
or lists.