SlideShare a Scribd company logo
1 of 2
Download to read offline
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 (10)

Lists methods
Lists methodsLists methods
Lists methods
 
Introduction to lists
Introduction to listsIntroduction to lists
Introduction to lists
 
Python lists
Python listsPython lists
Python lists
 
Python list functions
Python list functionsPython list functions
Python list functions
 
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.docxtienmixon
 
Simple c-programs
Simple c-programsSimple c-programs
Simple c-programsrashmi322
 
Master Python in 15 Days.pdf
Master Python in 15 Days.pdfMaster Python in 15 Days.pdf
Master Python in 15 Days.pdfJorgeTorres560505
 
Python assignment 4
Python assignment 4Python assignment 4
Python assignment 4ANILBIKAS
 
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'shammad463061
 
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.docxpriestmanmable
 
Application Animal Characteristics In today’.docx
           Application Animal Characteristics In today’.docx           Application Animal Characteristics In today’.docx
Application Animal Characteristics In today’.docxhallettfaustina
 
CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6helpido6
 
Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6Cis 355 ilab 6 of 6
Cis 355 ilab 6 of 6ashhadiqbal
 
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 Pointersenidcruz
 

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
 
Simple c-programs
Simple c-programsSimple c-programs
Simple c-programs
 
Best c programs
Best c programsBest c programs
Best 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 (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

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 

Recently uploaded (20)

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

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]