0% found this document useful (0 votes)
5 views

Array Questions

Uploaded by

meetu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Array Questions

Uploaded by

meetu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Q1.Write a program in Java to open 3 arrays of name A, P & N.

Store
15 numbers in array A. Shift all the positive even numbers in array P
and all the negative odd numbers in array N. Finally print the array P
& N.
Q2.Accept numbers into an array of size 10. Then accept a number
and search that number in array. If the number is present in array,
then display the array element number where number is found. In
case of multiple found display all the positions. Display a proper
message if the number is not present in array.
Q3. Write a program in JAVA to accept the name and marks in
computer science of forty students in an array and then print the
name and marks of students according to their merit.
Q4.Write a program in JAVA that reads the following list of countries
and their respective cities into two separate one-dimensional arrays.
The program should accept the name of a country as input and give
the name of the corresponding city as an output. The program
should be designed to give an error message where a city is asked
for a country whose name is not given in the list. To stop the
program, "XXX" is to be entered as input.
GERMANY BERLIN
NEPAL KATMANDU
JAPAN TOKYO
CANADA MONTREAL
INDIA DELHI
UAE ABU DHABI
Q5.WAP to create a single dimensional array of n integers. Print
only the Armstrong numbers from the array.

You might also like