0% found this document useful (0 votes)
5 views10 pages

Pattern Questions

The document contains 60 pattern printing questions with sample diagrams, covering a variety of shapes and patterns such as diamonds, triangles, and pyramids using stars, numbers, and other symbols. Each question specifies a parameter 'n' which indicates the size of the pattern to be printed. The patterns range from basic shapes to more complex designs, suitable for practice in programming and algorithm design.

Uploaded by

vyash4818
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)
5 views10 pages

Pattern Questions

The document contains 60 pattern printing questions with sample diagrams, covering a variety of shapes and patterns such as diamonds, triangles, and pyramids using stars, numbers, and other symbols. Each question specifies a parameter 'n' which indicates the size of the pattern to be printed. The patterns range from basic shapes to more complex designs, suitable for practice in programming and algorithm design.

Uploaded by

vyash4818
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

60 Pattern Printing Questions with Sample

Diagrams

1. Print a hollow diamond pattern of stars (n=5).


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

2. Pascal's Triangle (n=5).


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

3. Floyd's Triangle reverse aligned (n=5).


15 14 13 12 11
10 9 8 7
6 5 4
3 2
1

4. Butterfly pattern (n=5).


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

5. Zig-zag star pattern (n=9).


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

6. Numeric pyramid increasing left to right (n=5).


1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
7. Cross-diagonal rectangle pattern (n=5).
* * * * *
* * * *
* * *
* * * *
* * * * *

8. Hollow pyramid numbers (n=5).


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

9. Diamond with numbers increasing from center (n=5).


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

10. Sandglass star pattern (n=5).


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

11. Spiral matrix clockwise (n=4).


1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7

12. Checkerboard 1/0 (n=6).


1 0 1 0 1 0
0 1 0 1 0 1
1 0 1 0 1 0
0 1 0 1 0 1
1 0 1 0 1 0
0 1 0 1 0 1

13. Odd rows stars, even rows numbers (n=5).


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

14. Pyramid of Fibonacci numbers (n=5).


0
1 1
2 3 5
8 13 21 34
55 89 144 233 377

15. Hollow square with diagonals (n=5).


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

16. Concentric square numbers (n=4).


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

17. Star hourglass pattern (n=5).


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

18. Rhombus with numbers (n=5).


11111
22222
33333
44444
55555

19. Wave-like star pattern (rows=4, cols=9).


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

20. Numeric diamond repeating numbers (n=5).


1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
21. Alphabet pyramid (n=5).
A
B B
C C C
D D D D
E E E E E

22. Binary pyramid of row numbers (n=5).


1
10
11
100
101

23. Hollow inverted pyramid of stars (n=5).


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

24. Concentric circles approximation (n=7).


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

25. Right-aligned triangle with squares (n=5).


1
4 9
16 25 36
49 64 81 100
121 144 169 196 225

26. Symmetric X star pattern (n=5).


* *
* *
*
* *
* *

27. Numeric spiral anticlockwise (n=4).


1 12 11 10

2 13 16 9
3 14 15 8
4 5 6 7

28. Pyramid of prime numbers (n=5).


2
3 5
7 11 13
17 19 23 29
31 37 41 43 47
29. Arrow pointing upwards (n=5).
*
***
*****
*
*
*
*
*

30. Hollow diamond with numbers at boundary (n=5).


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

Basic Questions

Q1. Print a solid square of stars (n=5).


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

Q2. Print a right-angled triangle of stars (n=5).

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

Q3. Print an inverted right-angled triangle of stars (n=5).

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

Q4. Print a left-angled triangle of stars (n=5).

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

Q5. Print an inverted left-angled triangle of stars (n=5).


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

Q6. Print a hollow square (n=5).

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

Q7. Print a hollow right-angled triangle (n=5).

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

Q8. Print a hollow inverted right-angled triangle (n=5).

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

Q9. Print a pyramid of stars (n=5).

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

Q10. Print an inverted pyramid (n=5).

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

Q11. Print a diamond star pattern (n=5).


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

Q12. Print a hollow pyramid (n=5).

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

Q13. Print a hollow diamond star pattern (n=5)

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

Q14. Print a half-diamond pattern (n=5).

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

Q15. Print a number right-angled triangle (n=5).

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

Q16. Print a Floyd’s triangle (n=5).


1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Q17. Print a 0–1 triangle (n=5).

1
0 1
1 0 1
0 1 0 1
1 0 1 0 1

Q18. Print a Pascal’s triangle (n=5).

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

Q19. Print a binary triangle pattern (n=5).

1
1 0
1 0 1
1 0 1 0
1 0 1 0 1

Q20. Print a continuous number triangle (n=5).

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

Q21. Print a right-angled triangle with same number in row (n=5).

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

Q22. Print a star hill pattern (n=5).

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

Q23. Print alphabet C pattern (n=6)


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

Q24. Print an X pattern (n=5).

* *
* *
*
* *
* *

Q25. Print a plus sign pattern (n=5).

*
*
*****
*
*

Q26. Print a hollow diamond inside square (n=7).

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

Q27. Print a zigzag pattern (n=9).

* *
* * * *
* * *

Q28. Print a snake number pattern (n=5).

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

Q29. Print a wave pattern (n=6).

* * *
* * * *
* * * *
* *
Q30. Print a diamond outline with diagonal cross (n=7).

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

You might also like