100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
ENSF 694 MIDTERM EXAM QUESTIONS AND ANSWERS 2024/2025 FULLY SOLVED 100%;UNIVERSITY OF CALGARY $15.49   Add to cart

Exam (elaborations)

ENSF 694 MIDTERM EXAM QUESTIONS AND ANSWERS 2024/2025 FULLY SOLVED 100%;UNIVERSITY OF CALGARY

 13 views  0 purchase
  • Course
  • ENSF 694
  • Institution
  • ENSF 694

ENSF 694 MIDTERM EXAM QUESTIONS AND ANSWERS 2024/2025 FULLY SOLVED 100%;UNIVERSITY OF CALGARY

Preview 2 out of 8  pages

  • July 24, 2024
  • 8
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
  • ensf 694
  • ENSF 694
  • ENSF 694
avatar-seller
Wiseman
2024
ENSF 694 MIDTERM EXAM QUESTIONS AND ANSWERS 2024/2025 FULLY SOLVED 100%;UNIVERSITY OF CALGARY
ENSF 694
WISEMAN ENSF 694 MIDTERM EXAM QUESTIONS AND ANSWERS 2024/2025 FULLY SOLVED 100%;UNIVERSITY OF CALGARY
Multiple Choice Questions Section Select the best answer and indicate it by filling in the circles on the Scantron answer sheet. Answers on this exam booklet will
not be counted.
1.Consider the following code segment:
for (m = 1; m <= n; m++ ) for ( k = 1; k <= m; k++ )
for ( p = 1; p <= k; p++ )
x++;
Which one of the following equations are a better approximation of number line that will be executed in the code segment,
above:
a) 1/12 (n(n+1)(2n+1) + 3 n(n+1))
b) 1/12 ((n+1)(2n+1) + 3 n(n+1))
c) 1/6 (n(n+1)(2n+1) + 3 n(n+1))
d) 1/12 (n(n+1)(2n+1))
2.The following function calculates the Maximum Subsequence Sum of the numbers in an array that contains integer
numbers (possibly negative), using an iterative method.
int maxSumIterative (const A[], int N, int& left, int& right)
{
int maxSum = 0;
for( int i=0; i<N; i++)
for (int j = i; j < N; j++)
{
int thisSum = 0;
for (int k = i; k <= j; k++)
thisSum += A [k];
if( thisSum > maxSum )
{
maxSum = thisSum;
left = i;
right = j;
}
}
return maxSum;
}
3.What is the running time complexity, Big-O for this function?
a.O(N2)
b.O(N)
c.O(N3)
d.O(1)
4.Which one of the following statements are correct about three sort technique: Quick sort, Shell sort, and Bubble sort?
a.On average, Bubble sort is the slowest, Shell sort is fastest and Quick sort somewhere in the middle.
b.On average, Bubble sort is the slowest, Quick sort is fastest and Shell sort somewhere in the middle.
c.On average, Shell sort is the slowest, Quick sort is fastest and Shell sort somewhere in the middle.
5.The following function implements a binary-search on a sorted array:
int search(int L[], int low, int high, int x) {
if (high >= low) {
int mid = low + (high - low) / 2;
if (L[mid] == x)
return mid;
if (L[mid] > target)return search(L, low, mid - 1, x);
return search(L, mid + 1, high, tx);
}

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Wiseman. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $15.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73091 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$15.49
  • (0)
  Add to cart