Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CSC 110 Assignment 5 (4.1-5.2) Exam Questions And Answers 100% Pass

Beoordeling
-
Verkocht
-
Pagina's
17
Cijfer
A+
Geüpload op
11-11-2024
Geschreven in
2024/2025

CSC 110 Assignment 5 (4.1-5.2) Exam Questions And Answers 100% Pass Given an integer variable strawsOnCamel, write a statement that uses the auto-increment operator to increase the value of that variable by 1. - answerstrawsOnCamel++; Given an integer variable timer, write a statement that uses the auto-decrement operator to decrease the value of that variable by 1. - answertimer--; Consider this code: "int v = 20; --v; Sln(v++);". What value is printed, what value is v left with? 20 is printed, v ends up with 19 19 is printed, v ends up with 20 20 is printed, v ends up with 20 19 is printed, v ends up with 19 cannot determine what is printed, v ends up with 20 - answer19 is printed, v ends up with 20 Consider this code: "int s = 20; int t = s++ + --s;". What are the values of s and t? s is 19 and t is 38 s is 20 and t is 39 s is 19 and t is 39 s is 20 and t is 40 s is 20 and t cannot be determined - answers is 20 and t is 40 Given an int variable k that has already been declared, use a while loop to print a single line consisting of 88 asterisks. Use no variables other than k. - answerk=1; while(k=88) { ©THEBRIGHT EXAM SOLUTIONS 11/8/2024 12:08 PM S('*'); k++; } Sln(); Given an int variable n that has already been declared and initialized to a positive value, use a while loop to print a single line consisting of n asterisks. Use no variables other than n. - answerwhile(n0){ S("*"); n--; } Given an int variable k that has already been declared, use a do...while loop to print a single line consisting of 53 asterisks. Use no variables other than k. - answerk=53; do{ S("*"); k--; }while(k=1); Given an int variable n that has already been declared and initialized to a positive value, use a do...while loop to print a single line consisting of n asterisks. Use no variables other than n. - answerdo{ S("*"); n--; } while(n=1); Given an int variable k that has already been declared, use a for loop to print a single line consisting of 97 asterisks. Use no variables other than k. - answerfor(k=97;k=1;k--){ S("*"); } Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a for loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j. - answerfor (j = 0; j n; j++) ©THEBRIGHT EXAM SOLUTIONS 11/8/2024 12:08 PM { S("*"); } Write a for loop that prints the integers 0 through 39, separated by spaces. - answerfor(int i = 0; i40; i++) { S(i + " "); } Write a for loop that prints the odd integers 11 through 121 inclusive, separated by spaces. - answerfor(int i = 11; i=121; i+=2) { S(i + " "); } Write a for loop that prints in ascending order all the positive multiples of 5 that are less than 175, separated by spaces. - answerfor(int i = 5; i 175; i = i + 5) { S(i + " "); } Write a for loop that prints the integers 50 through 1, separated by spaces. Use no variables other than count. - answerfor (int count= 50; count = 1; count--) { S(count + " "); } Write a for loop that prints all the even integers from 80 through 20 inclusive, separated by spaces. - answerfor (int n = 80; n = 20; n-=2) { S(n + " "); } Write a for loop that prints in ascending order all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces. - answerfor (int n = 1; n 200; n++)

Meer zien Lees minder
Instelling
CSC 110
Vak
CSC 110

Voorbeeld van de inhoud

©THEBRIGHT EXAM SOLUTIONS

11/8/2024 12:08 PM


CSC 110 Assignment 5 (4.1-5.2) Exam
Questions And Answers 100% Pass


Given an integer variable strawsOnCamel, write a statement that uses the auto-increment operator to
increase the value of that variable by 1. - answer✔strawsOnCamel++;

Given an integer variable timer, write a statement that uses the auto-decrement operator to decrease
the value of that variable by 1. - answer✔timer--;

Consider this code: "int v = 20; --v; System.out.println(v++);". What value is printed, what value is v left
with?



20 is printed, v ends up with 19

19 is printed, v ends up with 20

20 is printed, v ends up with 20

19 is printed, v ends up with 19

cannot determine what is printed, v ends up with 20 - answer✔19 is printed, v ends up with 20

Consider this code: "int s = 20; int t = s++ + --s;". What are the values of s and t?



s is 19 and t is 38

s is 20 and t is 39

s is 19 and t is 39

s is 20 and t is 40

s is 20 and t cannot be determined - answer✔s is 20 and t is 40

Given an int variable k that has already been declared, use a while loop to print a single line consisting of
88 asterisks. Use no variables other than k. - answer✔k=1;

while(k<=88) {

, ©THEBRIGHT EXAM SOLUTIONS

11/8/2024 12:08 PM

System.out.print('*');

k++;

}

System.out.println();

Given an int variable n that has already been declared and initialized to a positive value, use a while loop
to print a single line consisting of n asterisks. Use no variables other than n. - answer✔while(n>0){

System.out.print("*");

n--;

}

Given an int variable k that has already been declared, use a do...while loop to print a single line
consisting of 53 asterisks. Use no variables other than k. - answer✔k=53;

do{

System.out.print("*");

k--;

}while(k>=1);

Given an int variable n that has already been declared and initialized to a positive value, use a do...while
loop to print a single line consisting of n asterisks. Use no variables other than n. - answer✔do{

System.out.print("*");

n--;

}

while(n>=1);

Given an int variable k that has already been declared, use a for loop to print a single line consisting of
97 asterisks. Use no variables other than k. - answer✔for(k=97;k>=1;k--){

System.out.print("*");

}

Given an int variable n that has already been declared and initialized to a positive value, and another int
variable j that has already been declared, use a for loop to print a single line consisting of n asterisks.
Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j. - answer✔for (j =
0; j < n; j++)

, ©THEBRIGHT EXAM SOLUTIONS

11/8/2024 12:08 PM

{

System.out.print("*");

}

Write a for loop that prints the integers 0 through 39, separated by spaces. - answer✔for(int i = 0; i<40;
i++)

{

System.out.print(i + " ");

}

Write a for loop that prints the odd integers 11 through 121 inclusive, separated by spaces. -
answer✔for(int i = 11; i<=121; i+=2)

{

System.out.print(i + " ");

}

Write a for loop that prints in ascending order all the positive multiples of 5 that are less than 175,
separated by spaces. - answer✔for(int i = 5; i < 175; i = i + 5)

{

System.out.print(i + " ");

}

Write a for loop that prints the integers 50 through 1, separated by spaces. Use no variables other than
count. - answer✔for (int count= 50; count >= 1; count--)

{ System.out.print(count + " ");

}

Write a for loop that prints all the even integers from 80 through 20 inclusive, separated by spaces. -
answer✔for (int n = 80; n >= 20; n-=2)

{

System.out.print(n + " ");

}

Write a for loop that prints in ascending order all the positive integers less than 200 that are divisible by
both 2 and 3, separated by spaces. - answer✔for (int n = 1; n< 200; n++)

Geschreven voor

Instelling
CSC 110
Vak
CSC 110

Documentinformatie

Geüpload op
11 november 2024
Aantal pagina's
17
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$11.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Thebright Florida State University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
220
Lid sinds
1 jaar
Aantal volgers
7
Documenten
13788
Laatst verkocht
1 dag geleden
Topscore Emporium.

On this page, you find verified, updated and accurate documents and package deals.

3.6

42 beoordelingen

5
15
4
10
3
9
2
3
1
5

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen