lista6 (PDF)




File information


Title: Microsoft Word - lista6.doc
Author: zs

This PDF 1.4 document has been generated by PScript5.dll Version 5.2.2 / Acrobat Distiller 8.1.0 (Windows), and has been sent on pdf-archive.com on 14/11/2012 at 19:16, from IP address 156.17.x.x. The current document download page has been viewed 910 times.
File size: 117.84 KB (1 page).
Privacy: public file




Document preview - lista6.pdf - Page 1/1





File preview


Paradygmaty programowania - ćwiczenia
Lista 6

1. (Scala) Zapisz w języku Scala zaprezentowane na wykładzie funkcje swap, partition, quick
i quicksort, zachowując ich styl programowania. Funkcje nie muszą być polimorficzne.
2. (Scala) Jedna z pętli w języku Scala ma następującą składnię: while (warunek) wyrażenie.
Napisz w Scali funkcję whileLoop, która pobiera dwa argumenty: warunek i wyrażenie
i symuluje działanie pętli while. Jakiego typu muszą być argumenty i wynik funkcji?

Działanie programów z zadań 3-4 należy wyjaśniać, rysując „obrazy pamięci” tych
programów, tzn. rysując referencje w postaci strzałek, komórki pamięci i ich zawartości.
3. Co i dlaczego wydrukuje poniższy program w Javie?
public class Porównanie{
public static void main(String[] args){
String s1 = "foo";
String s2 = "foo";
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
String s3 = new String("foo");
System.out.println(s1 == s3);
System.out.println(s1.equals(s3));
}
}

4. Co i dlaczego wydrukuje poniższy program w Javie?
public class Aliasy{
public static void main(String[] args){
int[] ints = {1,2,3};
for(int i : ints) {
System.out.println(i); i = 0;
}
for(int i : ints)
System.out.println(i);
int[] ints2 = ints;
for(int i=0; i<ints2.length; i++) {
System.out.println(ints2[i]); ints2[i] = -1;
}
for(int i : ints)
System.out.println(i);
}
}






Download lista6



lista6.pdf (PDF, 117.84 KB)


Download PDF







Share this file on social networks



     





Link to this page



Permanent link

Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..




Short link

Use the short link to share your document on Twitter or by text message (SMS)




HTML Code

Copy the following HTML code to share your document on a Website or Blog




QR Code to this page


QR Code link to PDF file lista6.pdf






This file has been shared publicly by a user of PDF Archive.
Document ID: 0000062558.
Report illicit content