Scala Programming List - Exercises, Practice, Solution
Scala Programming List [24 exercises with solution]
[An editor is available at the bottom of the page to write and execute the scripts.]
1. Write a Scala program to create a list in different ways. Go to the editor
Note: Use Lisp style, Java style, Range list, Uniform list, Tabulate list
Click me to see the sample solution
2. Write a Scala program to add single element and multiple elements to a given listbuffer/list. Go to the editor
Click me to see the sample solution
3. Write a Scala program to remove single and multiple elements from a given listbuffer/list. Go to the editor
Click me to see the sample solution
4. Write a Scala program to delete element(s) from a given List. Go to the editor
Click me to see the sample solution
5. Write a Scala program to iterate over a list to print the elements and calculate the sum and product of all elements of this list. Go to the editor
Click me to see the sample solution
6. Write a Scala program to find the largest and smallest number from a given list. Go to the editor
Click me to see the sample solution
7. Write a Scala program to remove duplicates from a given list. Go to the editor
Click me to see the sample solution
8. Write a Scala program to check a given list is empty or not. Go to the editor
Click me to see the sample solution
9. Write a Scala program to get the difference between two given lists. Go to the editor
Click me to see the sample solution
10. Write a Scala program to find the first and last element of given list. Go to the editor
Click me to see the sample solution
11. Write a Scala program to find the index of an element in a given list. Go to the editor
Click me to see the sample solution
12. Write a Scala program to merge (concatenate) given lists. Go to the editor
Click me to see the sample solution
13. Write a Scala program to find the even and odd numbers from a given list. Go to the editor
Click me to see the sample solution
14. Write a Scala program to find the nth element of a given list. Go to the editor
Click me to see the sample solution
15. Write a Scala program to find an element from the last position of a given list. Go to the editor
Click me to see the sample solution
16. Write a Scala program to reverse a given list. Go to the editor
Click me to see the sample solution
17. Write a Scala program to check a given list is a palindrome or not.
Click me to see the sample solution
18. Write a Scala program to flatten a given List of Lists, nested list structure. Go to the editor
Click me to see the sample solution
19. Write a Scala program to triplicate each element immediately next to the given list of integers. Go to the editor
Click me to see the sample solution
20. Write a Scala program to add each element n times to a given list of integers.
Click me to see the sample solution
21. Write a Scala program to check whether a list contains a sublist. Go to the editor
Click me to see the sample solution
22. Write a Scala program to count the number of occurrences of each element in a given list. Go to the editor
Click me to see the sample solution
23. Write a Scala program to split a given list into two lists. Go to the editor
Click me to see the sample solution
24. Write a Scala program to calculate the length of a given list. Go to the editor
Click me to see the sample solution
More...
Scala Code Editor:
More to Come !
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
Test your Python skills with w3resource's quiz
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework