Step Solutions
Save
Terms in this set (45)
In computing, the programming higher
language is a ________ ["higher", "lower"] lower
level of abstraction than the operating
system, and within a programming
language, individual statements are a
________ ["higher", "lower"] level of
abstraction than functions.
Marking members of a class as private Abstraction
so that the outside users of the class
can't see the implementation details is
important for data protection, but is
also an example of:
Consider the below C# snippet, and 6
assume some non-static class Thing
has has a public int x and is available
to the scope of the snippet:
Thing t1 = new Thing();
t1.x = 5;
Thing t2 = t1;
t2.x++;
t2 = new Thing();
t2.x = 10;
After executing the snippet, what is
the value of t1.x?
,Consider the following C# code - It has been assigned a value
snippet, and assume it compiles: - Its type implements IEnumerable
foreach(Thing t in things){ }
Which of the following must be true
about the variable things? Select all
that apply.
-It has been assigned a value
-It refers to an array of Thing
-It refers to a List<Thing>
-Its type implements IEnumerable
, Consider a class (below) that provides static
a GetDigits method for returning a list
of all of the digit characters in a string.
For example, if the input is "a1bc2", the
output should be a list containing '1'
and '2'.
public class StringUtil
{
private static List<char> digits = new
List<char>();
public List<char> GetDigits(string s)
{
foreach (char c in s)
if (Char.IsDigit(c))digits.Add(c);
return digits;
}
}
The class is buggy, and GetDigits only
seems to work correctly sometimes.
Here is an example of using StringUtil:
StringUtil sUtil = new StringUtil();
List<char> digits =
sUtil.GetDigits("abc123"); // returns the
correct resultStringUtil sUtil2 = new
StringUtil();
digits = sUtil2.GetDigits("xyz456"); //
returns an incorrect result
Change the StringUtil class by
removing exactly one keyword from
the code, so that the second call to
GetDigits in the example above
returns the correct result. Give the
keyword exa