0% found this document useful (0 votes)
36 views22 pages

Mock Questions

The document provides 47 programming problems related to arrays, including tasks like reversing an array, merging and sorting arrays, finding unique elements, averages and sums, deleting elements, and various star patterns to print. Many problems involve basic array operations while others focus on printing numeric or alphabetic patterns using arrays. Solutions would utilize common array methods like sorting, insertion, deletion and traversal.

Uploaded by

TUF GAMING
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views22 pages

Mock Questions

The document provides 47 programming problems related to arrays, including tasks like reversing an array, merging and sorting arrays, finding unique elements, averages and sums, deleting elements, and various star patterns to print. Many problems involve basic array operations while others focus on printing numeric or alphabetic patterns using arrays. Solutions would utilize common array methods like sorting, insertion, deletion and traversal.

Uploaded by

TUF GAMING
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

1. Write a program to reverse an array without using an additional array?

2. How to merge two unsorted arrays in sorted order ?

3. How to merge two sorted arrays?

4. Write a program to merge and sort elements of two different arrays

5. Write a program to print all unique elements in an array.

6. Write a program to remove all the prime numbers in an array

7. Program to find the average of n (n < 10) numbers using arrays

8. Program to find the average of n numbers using arrays

9. Write a Program to Delete an Integer from an Array of random numbers


10. Write a program to find the sum of all elements of the array

11. Write a program to copy the elements of one array into another array

12. Write a program to print all unique elements in an array

13. Write a program to insert a element in specified position in an array

14. Write a program to sort elements of array in ascending order

15. Write a program to insert New value in the array (sorted list )

16. Write a program to sort an array and print the count of unique elements in the array.

17. Write a program to print the sum of unique elements from an array
18. Write a program to delete all the multiples of 5 in an array.

19. Write a program to print an array of random numbers in reverse order.

20. How do you find the duplicate number on a given integer array

21. Write a program to delete two elements after the occurrence of a prime number and

replace all even numbers by 0.

22. Write a program to sort an array and print the count of ‘1’ in the array.

23. In an array, replace all the prime numbers with ‘ * ‘ & remove all the odd numbers.

24. Sort the array and replace elements in an odd position with * and remove prime

numbers

25. Find the sum of unique prime numbers in an array.


26. In an array remove all the prime numbers > 50 and remove all the non-prime numbers

< 50.

27. Write a program to count even and odd numbers in an array and also print the sum of

the even numbers in an array.

28. How do you find all pairs of an integer array whose sum is equal to a given number?

29. Write a program to delete two elements after the occurrence of a prime number and

replace all even numbers by 3.

30. Write a program to move all zeros to the beginning of an array.

31. Sort the array and replace elements in an odd position with * and remove prime

numbers

32. Write a program to read n number of values in an array and display the array after

deleting two values next to the multiples of 3.


33. Write a program to read an array and count even and odd numbers in an array and

also Print sum of the even numbers in an array.

34. Write a program to sort an array and print the count of ‘1’ in the array.

35. Write a program to delete two elements after the occurrence of an even number

36. Write a program to find array elements that repeat 2 times in the array.

37. Write a program to move all zeros to the end of an array

38. Write a program to merge two arrays of the same size sorted in descending

order.

39. Write a program to count the frequency of each element of an array.


40. Write a program to find the maximum and minimum element in an array.

41. Write a program to separate odd and even integers in separate arrays.

42. Write a program to insert New value in the array (sorted list ).

43. Write a program to insert New value in the array (unsorted list ) in (specific

position).

1.Write a program to print the following star pattern


**
*
*
*
****
****
*
*
*
******
******
******

2.Write a program to print the following star pattern

*
***
*
***
***
*
***
***
***
*
***
***
***
***

3.Write a program to print the following star pattern


***
***
*
******
******
*
*
*********
*********

4.Write a program to print the following star pattern


****
**
********
***
************
****
****************

6.Write a program to print the following star pattern


*****
*
**********
*
*
***************
*
*
*
********************

7.Write a program to print the following star pattern


**
*****
**
**
**********
**
**
**
***************
**
**
**
**

8.Write a program to print the following star pattern


*****
*
*
***
*
*
*****
*
*
***
*
*
*****

10.Write a program to print the following star pattern


**
**
*****
**
**
**********
**
**
***************

11.Write a program to print the following star pattern


*****
*
*
**********
*
*
*
*
***************
*
*
*
*
*
*

12.Print this pattern

* *
* *
* *
**
*
**
* *
* *
* *

13.Print the array elements in the following pattern.


*****
*
*
*
**********
*
*
*
*
*
*
***************

14.Write a program to print the following star pattern.

**
*
****
*
*
*
********
*
*
*
*
*

16.Write a program to print the following star pattern.

***
*
*
*
******
******
*
*
*
*********
*********
*********

17.Write a program to print the following star pattern

*
*
***
**
**
******
***
***
*********
18.Write a program to print the following number pattern.

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6

19.Write a program to print the following Alphabets pattern.

I
IN
IND
INDI
INDIA

20.Write a program to print the following Alphabets pattern.

M
MA
MAL
MALA
MALAY
MALAYA
MALAYAL
MALAYALA
MALAYALAM

21.Write a program to print the following pattern

*****
*****
*****
*****
*****

22.Write a program to print the following pattern

12345
2468
369
48
5

23.Write a program to print the following pattern

1
12
123
1234
12345
123456
12345
1234
123
12
1

24.Write a program to print the following pattern

A
11
BBB
2222
CCCCC
333333
DDDDDDD

25.Write a program to print the following pattern

1
2*2
3*3*3
4*4*4*4
4*4*4*4
3*3*3
2*2
1

26.Write a program to print the following pattern

*
* *
* *
* *
* *
* *
* *
* *
*
27.Write a program to print the following patten

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

28.Write a program to print the following patten

1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4

29.Write a program to print the following patten

30.Write a program to print the following pattern

*
* *
* *
* *
* *
***********

31.Write a program to print the following pattern

*******
******
*****
****
***
**
*
**
***
****
*****
******
*******

32.Write a program to print the following pattern

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21

33.Write a program to print the following pattern

A
B B
C C C
D D D D
E E E E E
F F F F F F

34.Write a program to print the following pattern

* *
* *
* *
* *
*

35.Write a program to print the following pattern

1
2 2
3 3
4 4
5 5

36.Write a program to print the following pattern

A B C D E
A B C D
A B C
A B
A

37.Write a program to print the following pattern.

* * **
* *
* *
* * * *

38.Write a program to print the following star pattern.


**********
*
********
*
*
******
*
*
*
****
*
*
*
*
**
*
*
*
*
*

39.Write a program to print the following star pattern.


*******
** **
* * * *
* * *
* * * *
* * **
*******
40.Write a program to print the following star pattern.
***
*
*
*
******
******
*
*
*
*********
*********
*********
41.Write a program to print the following star pattern.
******
*
******
*
*
******
*
*
*
******
*
*
*
*
******

45.Write a program to print the following star pattern


*****
*
*
***
*
*
*****
*
*
***
*
*
*****
42.Write a program to print the following star pattern

*
***
*
***
***
*
***
***
***
*
***
***
***
***

43.Write a program to print the following star pattern

X
XX
XXX
X
XX
XXX
XXXX
X
XX
XXX
XXXX
XXXXX

44.Write a program to print the following star pattern


XXXX
XXX
X
X
X
XXX
XX
X
X
X
XX
X

46.Write a program to print the following pattern.

*****
*****
*****
*****
*****

47.Write a program to print the following pattern.

1
12
123
1234
12345
123456
12345
1234
123
12
1

48.Write a program to print the following pattern.

1
123
12345
1234567
12345
123
1

50.Write a program to print the following pattern.


111111
111122
111333
114444
155555
666666

49.Write a program to print the following pattern.

123456
12345

1234

123

12

12

123

1234

12345

123456

51.Write a program to print the following pattern.

1
2*2
3*3*3
4*4*4*4
4*4*4*4
3*3*3
2*2
1

52.Write a program to print the following pattern.


*
$*
* $*
$*$*
*$*$*

53. Write a program to print the following star pattern.

*
***
*****
*******
*********
*******
*****
***
*

54.Print the following pattern

55.Write a program to print the following star pattern


56.Write a program to print the following star pattern

57.Write a program to print the following star pattern

X
XXX
X
X
XXXXXX
X
X
X
XXXXXXXXX

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy