[go: up one dir, main page]

0% found this document useful (0 votes)
46 views3 pages

Hello

The document contains 6 questions related to programming concepts. Question 1 asks to print a pattern of asterisks given an integer input. Question 2 asks to sum the numbers in a string. Question 3 asks to print all possible combinations of numbers in an array. Question 4 asks to print a string in a specific pattern given a integer input k. Question 5 asks to find the longest palindromic substring in a string. Question 6 asks to find the next greater number that can be made using the digits in a given number.
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)
46 views3 pages

Hello

The document contains 6 questions related to programming concepts. Question 1 asks to print a pattern of asterisks given an integer input. Question 2 asks to sum the numbers in a string. Question 3 asks to print all possible combinations of numbers in an array. Question 4 asks to print a string in a specific pattern given a integer input k. Question 5 asks to find the longest palindromic substring in a string. Question 6 asks to find the next greater number that can be made using the digits in a given number.
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/ 3

QUESTIONS

MAX MARKS: 60
1. print the pattern

*
*

*
*

*
*
If input is 5.
INPUT
An integer n.
OUTPUT
The above pattern .
2. Given a string, print the sum of numbers in the string
INPUT
Enter the string
Eg.
-> e2ir55g9
-> a4b0c11
OUTPUT
->66(2+55+9)
->15(4+0+11)
3. Print all the possible combination of numbers in an array.
INPUT
An integer n, size of array.
Read values into the array.
Eg.
->n=2
56

(5)

(5)

->n=3
123
OUTPUT
->{5},{6},{5,6}
->{1},{2},{3},{1,2}{1,3},{2,3},{1,2,3}

(in any order)

(10)

4. print the string in the following pattern.


INPUT
Enter a value k and a string
->K=3
abcdefghi
->k=4
abcdefghi
OUTPUT
(for k=3)
a
e
i
b d f h
c
g
(for k=4)
a
g
b
f h
c e
i
d
5. print longest palindromic substring (input can be a sentence).
Eg.
INPUT
BBABCBABPPRJ
OUTPUT
BABCBAB
6. find the next greater number.
INPUT
Read a number.

(10)

(15)

Eg.->12345
->34261
->54321
OUTPUT
(Print the next greater number by using these digits.)
Output->12354
->34612
->not possible

(15)

You might also like