Practise Problems for Labtest 5
24/11/11 08:51 Filed in: Labs
Practise Problems for Labtest 5
Part 1, 2
Given a string that represents a valid URL, can you construct a URL object from it?
Are you able to use the services of the URL class in order to obtaining a URLConnection object from a URL object?
Can you construct or conceive of a scenario in which a URL object will not have a URLConnection object?
Are you able to recognize the scenarios in which the URLConnection object will indeed be a HttpURLConnection object? Do you understand why this cannot be known at compile time and instead can only be known at run time?
Given an HttpURLConnection object, can you query it in order to reveal information about the request and receive messages (the messages that were exchanged in order to establish the connection).
Are you able to access the InputStream that is associated with an HttpURLConnection object and construct a Scanner from it?
Are you able to use the services of Scanner in order to obtain all of the html-formatted text from a website?
Given all of the html-formatted text from a website, can you process that text in order to extract information (such as all the level 1 headings or the paragraph elements that belong to a certain class)
Part 3, 4
In constructing a URL object, are you able to invoke the constructor so as to implement a particular query string, in order to access dynamic html content?
Can you imagine a app that would prompt the user for input and then fetch the associated information from a website (e.g., the abstract stock exchange website which will given live stock quotes for two-character stock symbols)?
Given a website that provides dynamic services via a query string, can you build an app that will make use of the dynamic services?
Part 1, 2
Given a string that represents a valid URL, can you construct a URL object from it?
Are you able to use the services of the URL class in order to obtaining a URLConnection object from a URL object?
Can you construct or conceive of a scenario in which a URL object will not have a URLConnection object?
Are you able to recognize the scenarios in which the URLConnection object will indeed be a HttpURLConnection object? Do you understand why this cannot be known at compile time and instead can only be known at run time?
Given an HttpURLConnection object, can you query it in order to reveal information about the request and receive messages (the messages that were exchanged in order to establish the connection).
Are you able to access the InputStream that is associated with an HttpURLConnection object and construct a Scanner from it?
Are you able to use the services of Scanner in order to obtain all of the html-formatted text from a website?
Given all of the html-formatted text from a website, can you process that text in order to extract information (such as all the level 1 headings or the paragraph elements that belong to a certain class)
Part 3, 4
In constructing a URL object, are you able to invoke the constructor so as to implement a particular query string, in order to access dynamic html content?
Can you imagine a app that would prompt the user for input and then fetch the associated information from a website (e.g., the abstract stock exchange website which will given live stock quotes for two-character stock symbols)?
Given a website that provides dynamic services via a query string, can you build an app that will make use of the dynamic services?
Practise Problems for Labtest 4
10/11/11 09:41 Filed in: Labs
Practice Questions for Labtest 04 (Set 1 of 2)
in addition to Ch 6 RQ's and Ch 6 exercises
Labtest 04 takes place Nov 17, 18, 21
Frequency
Given a string and a single target character, derive the frequency of the character within the string. You should be able to this using:
• Iteration and toCharArry()
• Iteration and charAt
• Iteration and substring
• replaceAll and length in combination
Given a string and a n-character long target string, derive the frequency of the
target string within the string. You should be able to this using:
• Iteration and substring
• replaceAll
Matching
Given a description of a domain of acceptable strings (and unacceptable strings), construct a test to see whether a given string is acceptable. You should be able to this using:
• if-elseif-else block and string equality testing
• matches and regular expressions
Implement a case-insensitive check whether two strings are the same
Substitution/Removal
Given a string, a single target character and a replacement character, implement character substitution. You should be able to this using:
• Iteration, condition testing, and string concatenation
• Iteration, condition testing, and a string buffer
• replaceAll
• all of the above, but with character removal rather than substitution
Given a string, a target string and a replacement string, implement substring substitution. You should be able to this using:
• Iteration, condition testing, and string concatenation
• Iteration, condition testing, and a string buffer
• Iteration, indexOf, and string concatenation
• Iteration, indexOf, and a StringBuffer
• replaceAll
• all of the above, but with substring removal rather than substitution
Given a description of a domain of acceptable strings (and unacceptable strings), implement code to remove all matching substrings
• replaceAll
Modification/Concatenation
Modification of a string in a position-sensitive manner, such as:
– user enters first and family name, separated by a space. want to insert the middle name into the string
– use String, use substring to split, then use concatenation and reassignment
– use StringBuffer, use insert
Given a string composed using string concatenation, accomplish the same result using a StringBuffer object
in addition to Ch 6 RQ's and Ch 6 exercises
Labtest 04 takes place Nov 17, 18, 21
Frequency
Given a string and a single target character, derive the frequency of the character within the string. You should be able to this using:
• Iteration and toCharArry()
• Iteration and charAt
• Iteration and substring
• replaceAll and length in combination
Given a string and a n-character long target string, derive the frequency of the
target string within the string. You should be able to this using:
• Iteration and substring
• replaceAll
Matching
Given a description of a domain of acceptable strings (and unacceptable strings), construct a test to see whether a given string is acceptable. You should be able to this using:
• if-elseif-else block and string equality testing
• matches and regular expressions
Implement a case-insensitive check whether two strings are the same
Substitution/Removal
Given a string, a single target character and a replacement character, implement character substitution. You should be able to this using:
• Iteration, condition testing, and string concatenation
• Iteration, condition testing, and a string buffer
• replaceAll
• all of the above, but with character removal rather than substitution
Given a string, a target string and a replacement string, implement substring substitution. You should be able to this using:
• Iteration, condition testing, and string concatenation
• Iteration, condition testing, and a string buffer
• Iteration, indexOf, and string concatenation
• Iteration, indexOf, and a StringBuffer
• replaceAll
• all of the above, but with substring removal rather than substitution
Given a description of a domain of acceptable strings (and unacceptable strings), implement code to remove all matching substrings
• replaceAll
Modification/Concatenation
Modification of a string in a position-sensitive manner, such as:
– user enters first and family name, separated by a space. want to insert the middle name into the string
– use String, use substring to split, then use concatenation and reassignment
– use StringBuffer, use insert
Given a string composed using string concatenation, accomplish the same result using a StringBuffer object
Third Study Group
07/11/11 12:44 Filed in: StudyGroups
A third study group has formed.
Hamda will be hosting a study group on Thursdays at 2pm.
Don't forget the other two study groups:
Meaghan's study group, 11am on Wednesdays.
Zach's study group, 11am on Mondays.
Study groups and office hours will be held in CSE1002, unless it is booked for another class. If CSE1002 is not available, then the meeting will take place in CSE1006.
Hamda will be hosting a study group on Thursdays at 2pm.
Don't forget the other two study groups:
Meaghan's study group, 11am on Wednesdays.
Zach's study group, 11am on Mondays.
Study groups and office hours will be held in CSE1002, unless it is booked for another class. If CSE1002 is not available, then the meeting will take place in CSE1006.
"Complementary" Midterm
01/11/11 12:04 Filed in: Midterm_Final
The "Complementary" Midterm will take place Thursday, November 3rd, 10-11:20am in the Curtis Lecture Hall I.
It is optional - you are not obliged to write it.
It is not an open book test.
The better of the marks from the Oct 18 and Nov 3 midterms will be used for your midterm mark.
Please see the Lecture 13 slides for additional detail about this midterm.
It is optional - you are not obliged to write it.
It is not an open book test.
The better of the marks from the Oct 18 and Nov 3 midterms will be used for your midterm mark.
Please see the Lecture 13 slides for additional detail about this midterm.