[go: up one dir, main page]

0% found this document useful (0 votes)
5 views1 page

Arrays

Arrays practice question for programming

Uploaded by

akashsandhu4x4
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 views1 page

Arrays

Arrays practice question for programming

Uploaded by

akashsandhu4x4
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/ 1

Arrays

Assume an array of ten integers:


A. Write a program to print all the elements larger than at least three other array elements
(without sorting/arranging).
B. Write a program to print all values having left and right values in order; consider both
ascending and descending order.
C. Suppose an array has digits 0 to 9 in the array. Find and print how far an element is from
its index.
D. Given that there is another
array of fifty elements repeating the elements of the first array in the second array, Write
code to find the element and its count having max occurrences in the second array.
E. Given that there is another array of the same size with different elements, From smallest
to largest number in each array, compare whether the element of the first array is smaller or
the second array is smaller.
F. Given that there is another array of the same size but different elements, Sort both arrays
concerning the first array and print the second array. Sort concerning the first array means
that after sorting, the first array will be sorted, whereas the second array may not be sorted.
G. A (string) character array of size 1000 has double or more spaces in some places, like
“This is a dog. His name is Brown. His color is White.” Write code to remove extra spaces
within the array or in another character array (whatever is convenient)
H. A string contains an email address. Verify that the email is valid. Check email has an “@”
symbol before “.” Check email has “.” after the “@” symbol. Print “OK” if the email is valid;
Otherwise, print “Invalid.”

You might also like