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

Mock Interview Questions

The document contains 40 programming problems involving arrays and patterns. The problems cover a wide range of array operations and patterns including counting elements, sorting, merging, separating odd/even and positive/negative numbers, finding maximum/minimum/unique/repeating elements, deleting elements, inserting elements, and more. It also includes 35 pattern printing problems using characters, numbers and symbols.

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)
24 views22 pages

Mock Interview Questions

The document contains 40 programming problems involving arrays and patterns. The problems cover a wide range of array operations and patterns including counting elements, sorting, merging, separating odd/even and positive/negative numbers, finding maximum/minimum/unique/repeating elements, deleting elements, inserting elements, and more. It also includes 35 pattern printing problems using characters, numbers and symbols.

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

Array

1. Write a program to count the total number of duplicate elements in an array.

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

3. Write a program to print all prime numbers in an array.

4. Write a program to merge two arrays sorted in descending order.

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

6. Write a program to find the largest and smallest number in an array.

7. Write a program to separate odd and even numbers in separate arrays.


8. Write a program to delete an element at a specific position from an array.

9. Write a program to find the second largest number in an array.

10. Write a program to find the second smallest number in an array.

11. Write a program to find the two repeating elements in a given array.

12. Write a program to separate prime and non-prime numbers in separate arrays.

13. Write a program to move all zeros(0’s) to the end of a given array.

14. Write a program to move all zeros(0’s) to the beginning of a given array.

15. Write a program to delete all duplicate elements from an array


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

17. Write a program to print all negative elements in an array

18. Write a program to count the total number of negative elements in an array.

19. Write a program to replace all Even numbers by 0 and Odd numbers by 1.

20. Write a program to replace all prime numbers by 0 and non-prime numbers by 1.

21. Write a program to sort and reverse an array.

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

23. Write a program to sort elements of array in descending order


24. Write a program to find the average of numbers in an array.

25. Write a program to separate positive and negative numbers in separate arrays.

26. Write a program to count the total number of unique elements in an array.

27. Write a program to count the total number of prime numbers in an array.

28. Write a program to delete all prime numbers in an array.


Patterns
1)Print this pattern.

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

2) print this pattern.

*
**
***
****
*****
******
*******
********
*********
**********
*********
********
*******
******
*****
****
***
**
*
3) Print this pattern using c programming.

1
232
34543
4567654
567898765

4) print this pattern using c programming.

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

5) print this pattern using c programming.

* *
** **
*** ***
*******
*** ***
** **
* *
6) print this pattern using c programming.

0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4
5 4 3 2 1 0 1 2 3 4 5

7) print this pattern using c programming.

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

8) print this pattern using c programming.

*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
9) print this pattern using c programming.

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

10) print this pattern using c programming.

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

11) print this pattern using c programming.

**********
**** ****
*** ***
** **
* *
* *
** **
*** ***
**** ****
**********
12) print this pattern using c programming.
*****
****
***
**
*
**
***
****
*****

13) print this pattern using c programming.

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

14) print this pattern using c programming.

*
*1*
*121*
*12321*
*1234321*
*123454321*
*1234321*
*12321*
*121*
*1*
*
15) print this pattern using c programming.

* *

* * * * * *

* * * * * * * * * *

* * * * * * * * * * *

16) print this pattern using c programming.

* * * * *

* * * *

* * *

* *

* *

* * *

* * * *

* * * * *
17)print this pattern using c programming.

22

333

4444

55555

666666

18) print this pattern using c programming.

*A*

*A*A*

*A*A*A*

19) print this pattern using c programming.

* * * * *

* *

* * * * *
20) print this pattern using c programming.

*******

*******

*******

*******

*******

*******

*******

21) print this pattern using c programming.

121

12321

1234321

123454321

12345654321
22) print this pattern using c programming.

5
45
345
2345
12345

23) print this pattern using c programming.

1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7
1 2 3 4 5
1 2 3
1
24)print this pattern using c programming.

ABCDEFGFEDCBA

ABCDEF FEDCBA

ABCDE EDCBA

ABCD DCBA

ABC CBA

AB BA

A A

25)print this pattern using c programming.

+
+
+
+++++++
+
+
+
26)print this pattern using c programming.

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

27)print this pattern using c programming.

********
** **
* * * *
* ** *
* ** *
* * * *
** **
********
28)print this pattern using c programming.

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

29)print this pattern using c programming.

*
$*
*$*
$*$*
*$*$*
30)print this pattern using c programming.

A
11
BBB
2222
CCCCC

31)print this pattern using c programming.

- - - - *
- - - * *
- - * * *
- * * * *
* * * * *

32) print this pattern using c programming.

***

*****

*******

*********

*** ***

*** ***

*** ***
33) print this pattern using c programming.

* * * *

* * * * *

* * * * * *

* * * * * * *

* * * * * * *

* * * * * * *

* * * * * * *

* * * * * *

* * * * *

* * * *

34) print this pattern using c programming.

*
**
***
****
*****
35) print this pattern using c programming.

CO

COM

COMP

COMPU

COMPUT

COMPUTE

COMPUTER

36) print this pattern using c programming.

HE

HEL

HELL

HELLO

HELL

HEL

HE

H
37) print this pattern using c programming.

12344321
123**321
12****21
1******1

38)print this pattern using c programming.

5432*
543*1
54*21
5*321
*4321

39)print this pattern using c programming.

" * "
" *** "
" ***** "
" ******* "
"*********"
40)print this pattern using c programming.

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

You might also like