SlideShare a Scribd company logo
Practice Problems on Array
1. Write a Swift program to check if 5 appears as either the first or last element in a given array of
integers. The array length should be 1 or more.
2. Write a Swift program to check whether the first element and the last element of a given array of
integers are equal. The array length must be 1 or more.
3. Write a Swift program to test if two given arrays of integers have the same first and last element.
Both arrays length must be 1 or more.
4. Write a Swift program to compute the sum of all the elements of a given array of integers and
length 4.
5. Write a Swift program to rotate the elements of an array of integers to left direction. Therefore {1,
2, 3} yields {2, 3, 1}.
6. Write a Swift program to create a new array with the elements in reverse order of a given array of
integer
7. Write a Swift program to find the larger value of a given array of integers and set all the other
elements with that value. Return the changed array.
8. Write a Swift program to compute the sum of the first 2 elements of a given array of integers.
Return 0 if the length of the given array is 0 and return the first element value If the array length is
less than 2.
9. Write a Swift program to create a new array of length 2 containing the middle elements from two
give array of integers and length 3.
10. Write a Swift program to create a new array of length 2 containing the first and last elements
from a given array of integers. The given array length must be 1 or more.
11. Write a Swift program to test if an array of integers contains a 3 or a 5.
12. Write a Swift program to test if an array of integers does not contain a 3 or a 5.
13. Write a Swift program to create a new array with double the length of a given array of integers
and its last element is the same as the given array. The given array will be length 1 or more. By
default, a new integer array contains all 0's.
14. Write a Swift program to check if a given array of integers contains 3 twice, or 5 twice.
15. Write a Swift program to check if two given arrays of integers have 0 as their first element.
16. Write a Swift program to compute the sum of the values of two given array of integers and each
length 2. Find the array which has the largest sum and return the first array if the sum of two given
arrays are equal.
17. Write a Swift program to create an array of length 2 containing the middle two elements from a
given array of integers and even length 2 or more.
18. Write a Swift program to test if an array of length four containing all their elements from two
given array (each length two) of integers,
19. Write a Swift program to swap the first and last elements of a given array of integers. Return the
modified array (length will be at least 1).
20. Write a Swift program to create a new array of length 3 containing the elements from the
middle of a given array of integers and length will be at least 3.
21. Write a Swift program to find the largest value from the first, last, and middle values in a given
array of integers and length will be at least 1.
22. Write a Swift program to create a new array, taking first two elements from a given array of
integers. If the length of the given array is less than 2 use the single element of the given array.
23. Write a Swift program to create a new array taking the first element from two given arrays of
integers. If either array is length 0, ignore that array.
24. Write a Swift program to count the number of even integers in the given array.
25. Write a Swift program to find the difference between the largest and smallest values in a given
array of integers and length 1 or more.
26. Write a Swift program to compute the sum of the numbers of a given array of integers except
the number immediately after a 11.
27. Write a Swift program to check if a given array of integers contains a 3 next to a 3 somewhere.
28. Write a Swift program to test if the number of 1's is greater than the number of 3's of a given
array of integers.
29. Write a Swift program to test if every element is a 2 or a 5 of a given array of integers.
30. Write a Swift program to check if a given array of integers contains no 2's or it contains no 5's.
31. Write a Swift program to check if a given array of integers contains a 3 next to a 3 or a 5 next to
a 5, but not both.
32. Write a Swift program to test if a given array of integers contains two 5's next to each other, or
there are two 5's separated by one element.
33. Write a Swift program to test if there is a 1 in the array with a 3 somewhere later in a given array
of integers.
34. Write a Swift program to test if a given array of integers contains either 2 even or 2 odd values
all next to each other.
35. Write a Swift program to test if the value 5 appears in a given array of integers exactly 2 times,
and no 5's are next to each other.
36. Write a Swift program to test if every 3 that appears in a given array of integers is next to
another 3.
37. Write a Swift program to test if a given array of integers contains three increasing adjacent
numbers.
38. Write a Swift program to create a new array that is left shifted from a given array of integers. So
[11, 15, 13, 10, 45, 20]

More Related Content

What's hot

Lists methods
Lists methodsLists methods
Lists methods
aiclub_slides
 
Introduction to lists
Introduction to listsIntroduction to lists
Introduction to lists
aiclub_slides
 
Python list functions
Python list functionsPython list functions
Python list functions
Aishwarya Deshmukh
 
Double linked list c8
Double linked list c8Double linked list c8
Double linked list c8
Omar Al-Sabek
 
Searching techniques
Searching techniquesSearching techniques
Searching techniques
ER Punit Jain
 
Workshop 04 Review
Workshop 04 ReviewWorkshop 04 Review
Workshop 04 Reviewmigiwara
 
Working of Merge Sort Code
Working of Merge Sort CodeWorking of Merge Sort Code
Working of Merge Sort Code
Muhammad Abdullah
 
Pa1 session 2
Pa1 session 2 Pa1 session 2
Pa1 session 2
aiclub_slides
 
Python nltk synonyms and antonyms
Python nltk synonyms and antonymsPython nltk synonyms and antonyms
Python nltk synonyms and antonyms
Rati Sharma
 

What's hot (10)

Lists methods
Lists methodsLists methods
Lists methods
 
Introduction to lists
Introduction to listsIntroduction to lists
Introduction to lists
 
Python list functions
Python list functionsPython list functions
Python list functions
 
Python lists
Python listsPython lists
Python lists
 
Double linked list c8
Double linked list c8Double linked list c8
Double linked list c8
 
Searching techniques
Searching techniquesSearching techniques
Searching techniques
 
Workshop 04 Review
Workshop 04 ReviewWorkshop 04 Review
Workshop 04 Review
 
Working of Merge Sort Code
Working of Merge Sort CodeWorking of Merge Sort Code
Working of Merge Sort Code
 
Pa1 session 2
Pa1 session 2 Pa1 session 2
Pa1 session 2
 
Python nltk synonyms and antonyms
Python nltk synonyms and antonymsPython nltk synonyms and antonyms
Python nltk synonyms and antonyms
 

Similar to practice problems on array IN SWIFT

Tutorial 04 (revised) (1)
Tutorial 04 (revised) (1)Tutorial 04 (revised) (1)
Tutorial 04 (revised) (1)
IIUM
 
Please Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docxPlease Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docx
tienmixon
 
Simple c-programs
Simple c-programsSimple c-programs
Simple c-programs
rashmi322
 
A10
A10A10
A10
lksoo
 
Master Python in 15 Days.pdf
Master Python in 15 Days.pdfMaster Python in 15 Days.pdf
Master Python in 15 Days.pdf
JorgeTorres560505
 
Python assignment 4
Python assignment 4Python assignment 4
Python assignment 4
ANILBIKAS
 
Discrete structure ch 3 short question's
Discrete structure ch 3 short question'sDiscrete structure ch 3 short question's
Discrete structure ch 3 short question's
hammad463061
 
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
priestmanmable
 
easyPy-Basic.pdf
easyPy-Basic.pdfeasyPy-Basic.pdf
easyPy-Basic.pdf
Mina Firoozgohar
 
Application Animal Characteristics In today’.docx
           Application Animal Characteristics In today’.docx           Application Animal Characteristics In today’.docx
Application Animal Characteristics In today’.docx
hallettfaustina
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6ashhadiqbal
 
CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6helpido6
 
Java programlist (1)
Java programlist (1)Java programlist (1)
Java programlist (1)
Aditya Aggarwal
 
Array sheet
Array sheet Array sheet
Array sheet
Mahmoud Abuelmagd
 
lists
listslists
lists
Rajendran
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
İbrahim Kürce
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 
Lab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and PointersLab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and Pointers
enidcruz
 

Similar to practice problems on array IN SWIFT (20)

Tutorial 04 (revised) (1)
Tutorial 04 (revised) (1)Tutorial 04 (revised) (1)
Tutorial 04 (revised) (1)
 
Please Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docxPlease Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docx
 
Best c programs
Best c programsBest c programs
Best c programs
 
Simple c-programs
Simple c-programsSimple c-programs
Simple c-programs
 
Arrays.pdf
Arrays.pdfArrays.pdf
Arrays.pdf
 
A10
A10A10
A10
 
Master Python in 15 Days.pdf
Master Python in 15 Days.pdfMaster Python in 15 Days.pdf
Master Python in 15 Days.pdf
 
Python assignment 4
Python assignment 4Python assignment 4
Python assignment 4
 
Discrete structure ch 3 short question's
Discrete structure ch 3 short question'sDiscrete structure ch 3 short question's
Discrete structure ch 3 short question's
 
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
 
easyPy-Basic.pdf
easyPy-Basic.pdfeasyPy-Basic.pdf
easyPy-Basic.pdf
 
Application Animal Characteristics In today’.docx
           Application Animal Characteristics In today’.docx           Application Animal Characteristics In today’.docx
Application Animal Characteristics In today’.docx
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6
 
CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6
 
Java programlist (1)
Java programlist (1)Java programlist (1)
Java programlist (1)
 
Array sheet
Array sheet Array sheet
Array sheet
 
lists
listslists
lists
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
Lab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and PointersLab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and Pointers
 

More from LOVELY PROFESSIONAL UNIVERSITY

Enumerations, structure and class IN SWIFT
Enumerations, structure and class IN SWIFTEnumerations, structure and class IN SWIFT
Enumerations, structure and class IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
Dictionaries IN SWIFT
Dictionaries IN SWIFTDictionaries IN SWIFT
Dictionaries IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
Control structures IN SWIFT
Control structures IN SWIFTControl structures IN SWIFT
Control structures IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
Arrays and its properties IN SWIFT
Arrays and its properties IN SWIFTArrays and its properties IN SWIFT
Arrays and its properties IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
Array and its functionsI SWIFT
Array and its functionsI SWIFTArray and its functionsI SWIFT
Array and its functionsI SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
practice problems on array IN SWIFT
practice problems on array IN SWIFTpractice problems on array IN SWIFT
practice problems on array IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
practice problems on array IN SWIFT
practice problems on array  IN SWIFTpractice problems on array  IN SWIFT
practice problems on array IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING
LOVELY PROFESSIONAL UNIVERSITY
 
Variables and data types IN SWIFT
 Variables and data types IN SWIFT Variables and data types IN SWIFT
Variables and data types IN SWIFT
LOVELY PROFESSIONAL UNIVERSITY
 
Soft skills. pptx
Soft skills. pptxSoft skills. pptx
STRINGS IN JAVA
STRINGS IN JAVASTRINGS IN JAVA
COMPLETE CORE JAVA
COMPLETE CORE JAVACOMPLETE CORE JAVA
COMPLETE CORE JAVA
LOVELY PROFESSIONAL UNIVERSITY
 
Data wrangling IN R LANGUAGE
Data wrangling IN R LANGUAGEData wrangling IN R LANGUAGE
Data wrangling IN R LANGUAGE
LOVELY PROFESSIONAL UNIVERSITY
 

More from LOVELY PROFESSIONAL UNIVERSITY (18)

Enumerations, structure and class IN SWIFT
Enumerations, structure and class IN SWIFTEnumerations, structure and class IN SWIFT
Enumerations, structure and class IN SWIFT
 
Dictionaries IN SWIFT
Dictionaries IN SWIFTDictionaries IN SWIFT
Dictionaries IN SWIFT
 
Control structures IN SWIFT
Control structures IN SWIFTControl structures IN SWIFT
Control structures IN SWIFT
 
Arrays and its properties IN SWIFT
Arrays and its properties IN SWIFTArrays and its properties IN SWIFT
Arrays and its properties IN SWIFT
 
Array and its functionsI SWIFT
Array and its functionsI SWIFTArray and its functionsI SWIFT
Array and its functionsI SWIFT
 
practice problems on array IN SWIFT
practice problems on array IN SWIFTpractice problems on array IN SWIFT
practice problems on array IN SWIFT
 
practice problems on array IN SWIFT
practice problems on array  IN SWIFTpractice problems on array  IN SWIFT
practice problems on array IN SWIFT
 
10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING
 
Variables and data types IN SWIFT
 Variables and data types IN SWIFT Variables and data types IN SWIFT
Variables and data types IN SWIFT
 
Soft skills. pptx
Soft skills. pptxSoft skills. pptx
Soft skills. pptx
 
JAVA
JAVAJAVA
JAVA
 
Unit 5
Unit 5Unit 5
Unit 5
 
Unit 4
Unit 4Unit 4
Unit 4
 
Unit 3
Unit 3Unit 3
Unit 3
 
STRINGS IN JAVA
STRINGS IN JAVASTRINGS IN JAVA
STRINGS IN JAVA
 
Unit 1
Unit 1Unit 1
Unit 1
 
COMPLETE CORE JAVA
COMPLETE CORE JAVACOMPLETE CORE JAVA
COMPLETE CORE JAVA
 
Data wrangling IN R LANGUAGE
Data wrangling IN R LANGUAGEData wrangling IN R LANGUAGE
Data wrangling IN R LANGUAGE
 

Recently uploaded

Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 

practice problems on array IN SWIFT

  • 1. Practice Problems on Array 1. Write a Swift program to check if 5 appears as either the first or last element in a given array of integers. The array length should be 1 or more. 2. Write a Swift program to check whether the first element and the last element of a given array of integers are equal. The array length must be 1 or more. 3. Write a Swift program to test if two given arrays of integers have the same first and last element. Both arrays length must be 1 or more. 4. Write a Swift program to compute the sum of all the elements of a given array of integers and length 4. 5. Write a Swift program to rotate the elements of an array of integers to left direction. Therefore {1, 2, 3} yields {2, 3, 1}. 6. Write a Swift program to create a new array with the elements in reverse order of a given array of integer 7. Write a Swift program to find the larger value of a given array of integers and set all the other elements with that value. Return the changed array. 8. Write a Swift program to compute the sum of the first 2 elements of a given array of integers. Return 0 if the length of the given array is 0 and return the first element value If the array length is less than 2. 9. Write a Swift program to create a new array of length 2 containing the middle elements from two give array of integers and length 3. 10. Write a Swift program to create a new array of length 2 containing the first and last elements from a given array of integers. The given array length must be 1 or more. 11. Write a Swift program to test if an array of integers contains a 3 or a 5. 12. Write a Swift program to test if an array of integers does not contain a 3 or a 5. 13. Write a Swift program to create a new array with double the length of a given array of integers and its last element is the same as the given array. The given array will be length 1 or more. By default, a new integer array contains all 0's. 14. Write a Swift program to check if a given array of integers contains 3 twice, or 5 twice. 15. Write a Swift program to check if two given arrays of integers have 0 as their first element. 16. Write a Swift program to compute the sum of the values of two given array of integers and each length 2. Find the array which has the largest sum and return the first array if the sum of two given arrays are equal. 17. Write a Swift program to create an array of length 2 containing the middle two elements from a given array of integers and even length 2 or more. 18. Write a Swift program to test if an array of length four containing all their elements from two given array (each length two) of integers,
  • 2. 19. Write a Swift program to swap the first and last elements of a given array of integers. Return the modified array (length will be at least 1). 20. Write a Swift program to create a new array of length 3 containing the elements from the middle of a given array of integers and length will be at least 3. 21. Write a Swift program to find the largest value from the first, last, and middle values in a given array of integers and length will be at least 1. 22. Write a Swift program to create a new array, taking first two elements from a given array of integers. If the length of the given array is less than 2 use the single element of the given array. 23. Write a Swift program to create a new array taking the first element from two given arrays of integers. If either array is length 0, ignore that array. 24. Write a Swift program to count the number of even integers in the given array. 25. Write a Swift program to find the difference between the largest and smallest values in a given array of integers and length 1 or more. 26. Write a Swift program to compute the sum of the numbers of a given array of integers except the number immediately after a 11. 27. Write a Swift program to check if a given array of integers contains a 3 next to a 3 somewhere. 28. Write a Swift program to test if the number of 1's is greater than the number of 3's of a given array of integers. 29. Write a Swift program to test if every element is a 2 or a 5 of a given array of integers. 30. Write a Swift program to check if a given array of integers contains no 2's or it contains no 5's. 31. Write a Swift program to check if a given array of integers contains a 3 next to a 3 or a 5 next to a 5, but not both. 32. Write a Swift program to test if a given array of integers contains two 5's next to each other, or there are two 5's separated by one element. 33. Write a Swift program to test if there is a 1 in the array with a 3 somewhere later in a given array of integers. 34. Write a Swift program to test if a given array of integers contains either 2 even or 2 odd values all next to each other. 35. Write a Swift program to test if the value 5 appears in a given array of integers exactly 2 times, and no 5's are next to each other. 36. Write a Swift program to test if every 3 that appears in a given array of integers is next to another 3. 37. Write a Swift program to test if a given array of integers contains three increasing adjacent numbers. 38. Write a Swift program to create a new array that is left shifted from a given array of integers. So [11, 15, 13, 10, 45, 20]