100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Instructors Solutions Manual Introduction to Java Programming and Data Structures Comprehensive Version ABET Course ,Assessment ACM-IEEE Curricular 2013, UML Diagram Solution $18.48   Add to cart

Exam (elaborations)

Instructors Solutions Manual Introduction to Java Programming and Data Structures Comprehensive Version ABET Course ,Assessment ACM-IEEE Curricular 2013, UML Diagram Solution

 10 views  0 purchase
  • Course
  • SolutionManual
  • Institution
  • SolutionManual

Instructors Solutions Manual Introduction to Java Programming and Data Structures Comprehensive Version ABET Course ,Assessment ACM-IEEE Curricular 2013, UML Diagram Solution

Preview 4 out of 60  pages

  • August 8, 2024
  • 60
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • SolutionManual
  • SolutionManual
avatar-seller
solutions
Sample Final Exam for CSCI 1301 (Java) Covers chapters 1-8


FINAL EXAM AND COURSE OUTCOMES MATCHING
COURSE OUTCOMES
Upon successful completion of this course, students should be able to
1. analyze and design strategies for solving basic programming problems.
2. use primitive data types, selection statements, loops, methods to write programs.
3. develop programs to solve a variety of problems in math, science, business, and
games.
4. use the step-wise refinement approach.
5. use arrays to store, process, and sort data.
6. use an IDE to develop programs.


Here is a mapping of the final comprehensive exam against the course outcomes:

Question Matches outcomes
Part I(a) 2
Part I(b) 2
Part I(c) 2
Part II(a) 2
Part II(b) 2
Part II(c) 2
Part II(d) 2
Part II(e) 2, 5
Part III(a) 1, 2, 3
Part III(b) 1, 2, 3, 4
Part III(c) 1, 2, 3, 4, 5
Part VI 1, 2, 3, 4, 5




1

, Name:__________________ CSCI 1301 Final
Armstrong Atlantic State University
Covers chs 1-8 Instructor: Dr. Y. Daniel Liang

Please note that the university policy prohibits giving the exam score by email. If you need to know your
final exam score, come to see me during my office hours next semester.

I pledge by honor that I will not discuss the contents of this exam with
anyone.

Signed by ___________________ Date ___________________


Part I. (2 pts each)
a. How many times is the following loop body repeated? What is the
output of the loop?
int i = 0;
while (i < 10) {
if ((i + 1) % 2 == 0)
System.out.println(i);

i++;
}

b. Convert the following for loop into a do-while loop.

int sum = 0;
for (int i = 0; i < 100; i++) {
sum += i;
}

c. Convert the following if statement using a switch statement

// Find interest rate based on year
if (numOfYears == 7)
annualInterestRate = 7.25;
else if (numOfYears == 15)
annualInterestRate = 8.50;
else if (numOfYears == 30)
annualInterestRate = 9.0;
else {
System.out.println("Wrong number of years");
System.exit(0);
}



Part II: Show the output of the following code:

a: (2 pts)

public class Test1 {
public static void main(String[] args) {
int i = 1;
while (i < 10) {
System.out.print(i + " ");
i = i + 3;



2

, }
}
}

b. (3 pts)
Suppose the input is 2 3 4 5 0. What is the output of the
following code?

import java.util.Scanner;


public class Test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

int number, max;
number = input.nextInt();
max = number;

while (number != 0) {
number = input.nextInt();
if (number > max)
max = number;
}

System.out.println("max is " + max);
System.out.println("number " + number);
}
}

c. (3 pts)
public class Test {
public static void main(String[] args) {
System.out.println(xMethod(5672));
}

public static int xMethod(int number) {
int result = 0;
while (number != 0) {
int remainder = number % 10;
result = result * 10 + remainder;
number = number / 10;
}

return result;
}
}


d. (3 pt)
public class Test {
public static void main(String[] args) {
int number = 0;
int[] numbers = new int[1];




3

, m(number, numbers);

System.out.println("number is " + number
+ " and numbers[0] is " + numbers[0]);
}

public static void m(int x, int[] y) {
x = 3;
y[0] = 3;
}
}



e. (3 pt) Suppose the input is 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3
4. What is the output of the following code?
import java.util.Scanner;

public class Test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

double[][] m = new double[4][4];

for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
m[i][j] = input.nextDouble();

System.out.print(ttt(m));
}

public static int ttt(double[][] m) {
int sum = 0;

for (int i = 0; i < m.length; i++)
sum += m[i][i];

return sum;
}
}




4

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 solutions. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73314 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
$18.48
  • (0)
  Add to cart