GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

The following code segment is supposed to determine whether…

The following code segment is supposed to determine whether or not a string is a palindrome, meaning that it is the same forward and backward. def isPalindrome(s: str) -> bool :    return palindromeHelper(s, 0, len(s) – 1) def palidromeHelper(s: str, l: int, h: int) -> bool :    if h

Read Details

Consider the triangleArea function from the textbook shown b…

Consider the triangleArea function from the textbook shown below: 1. def triangleArea(sideLength: int) -> int:2.     if sideLength

Read Details

Consider the following code segment: def sumList(data: list[…

Consider the following code segment: def sumList(data: list[int]) -> int:    return sumListIndex(data, 0) def sumListIndex(data: list[int], i: int) -> int:    if i == len(data) :        return 0    else :        return data[i] + sumListIndex(data, i + 1) This code segment contains an example of: _____________

Read Details

Consider the following function for computing the greatest c…

Consider the following function for computing the greatest common divisor of two integers greater than 0: def gcd(x: int, y: int) -> int:  # Line 1    if x % y == 0:                     # Line 2        return y                         # Line 3    else :        return gcd(y, x % y)      # Line 4 Which line contains a recursive function call?

Read Details

How many recursive calls to the fib function shown below wou…

How many recursive calls to the fib function shown below would be made from an original call to fib(4)? (Do not count the original call) def fib(n: int) -> int:    # assumes n >= 0    if n

Read Details

Consider the following code segment: def mystery_print(n: in…

Consider the following code segment: def mystery_print(n: int) -> int :    if n == 0 :        return 0    else :        return n + mystery_print(n – 1) What is returned for the call mystery_print(-4)?

Read Details

Consider the following code segment: def triangle_area (side…

Consider the following code segment: def triangle_area (sideLength: int) -> int:    if sideLength == 1:        return 1    return triangle_area(sideLength – 1) + sideLength print(triangle_area(5)) How many times is the triangle_area function called when this code segment executes?

Read Details

The printList function is supposed to print all of the eleme…

The printList function is supposed to print all of the elements in a list, one per line. What line of code should be placed in the blank to achieve this goal? def printList(data: list[str]) -> None :    ____________________ def printHelper(data: list[str], i: int) -> None :    if i == len(data) :        return    print(data[i])    printHelper(data, i + 1)

Read Details

A recursive computation solves a problem using the solution…

A recursive computation solves a problem using the solution to the same problem with ____________________ inputs.

Read Details

Ergänzen Sie die Sätze. Achten Sie auf die Verbposition und…

Ergänzen Sie die Sätze. Achten Sie auf die Verbposition und die richtige Form.  Beispiel Zum Frühstück … Brot mit Marmelade. (Johanna/essen) Zum Frühstück isst Johanna Brot mit Marmelade. 1. [1] auch ein Stück Käse.(er/möchten) 2. Morgens [2] gern Apfelsaft. (meine Kinder/trinken)  3. [3] einen Salat, bitte.(ich/nehmen) 4. [4] noch Wasser?(ihr/möchten) 5. Am Nachmittag [5] gern ein Stück Kuchen.(mein Mann/essen)

Read Details

Posts pagination

Newer posts 1 … 416 417 418 419 420 … 81,830 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top