Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a python program that: 

  • • asks the user for the number of students and subjects to be managed. 
  • • For each student, asks the user for the mark obtained in all subjects 
  • • Calculates the final score of each student considering that all subjects have a coefficient equal to 1. 
  • • Displays the best final score (maximum) and the student who obtained it. 

Note: 

- Students are referred to using an ID (automatically incremented, starting from 1). 

Write a program to print the absolute difference between the two given numbers. (Absolute difference is the difference without the negative sign)


Write a program that plays a dice game with the user. The specification: The user begins with a score of 1000. The user is asked how many points to risk and then the computer rolls two dice. If an even total is rolled, the user loses the points at stake. If an odd total is rolled, the user receives double the points at stake. The program output may look similar to:

(User’s input is underlined)


Sample Run:

You have 1000 points.

Points to risk: 100

Roll is 3 and 5.

You lose.

Play again? Y


You have 900 points.

Points to risk: 200

Roll is 1 and 2.

You win.

Play again? N


Final score: 1300



Task should be accomplished by a user defined function(s).A prime number is an integer that has no factors other than one and itself. For example, 2, 3, 5, and 7 are prime while 9, 10, and 15 are not.Write a function IsPrime() that accepts a long greater than 1 as a parameter and returns a bool. The function should return true if and only if the integer is prime.



 1. Using practical examples, describe green computing. List and explain the steps that you can take to contribute to green computing


3) Refer to the code segment below and answer the questions in the comments labelled Question i – vi. For each answer; provide a brief explanation for your answer.


public class Scope {

private int x = 2;

private int x = 1;


public void start() {

int x = 5;

int x = 2;


//Question i

System.out.printf( "The value of x is %d\n", x );

int x = 2; 


//Question ii

System.out.printf( "\nThe value of x is is %d\n", x );

} // end method begin


public void middle() {

int x = 25;


//Question iii

System.out.printf( "\nThe value of x is %d\n", x );

++x; 


//Question iv

System.out.printf( "The value of x is %d\n", x );

} // end method middle


public void end() { 


//Question v

System.out.printf( "\nThe value of x is %d\n", x );

x *= 10; 


//Question vi

System.out.printf( "The value of x is %d\n", x );

} // end method end


} // end class Scope


• Describe (4) FOUR general strategies for dealing with deadlocks.?

• What are the (4) FOUR conditions required for deadlock to occur?


A. Consider a problem to find the student who had the highest GPA for the 2020/2021 academic year. i. Explain your choice of either a search or a sorting algorithm to solve this problem.


ii. Write the algorithm for your implementation. [


B. Consider the analogy of a pile of books on a table. Using a diagram, explain the basic operations involved in adding a book to the pile and removing a book from the pile.


C. Use the code below to answer the questions that follow:


public class CS204 { public static int linearSearch(int[] data, int target) {


for (int i = 0; i < data; i++) {

if (target == data[i]){ return i; 5

}


}

return -1;


}


public void main(String[] args) {

int[] data = {3, 14, 7, 22, 45, 12, 19, 42, 6};

System.out.println("Search for 7: " +

linearSearch(7));


}

}


i. Why is method linearSearch declared static?

ii. Identify and resolve the errors in the code.

(b) Compare the two policies and then create a policy you believe would be fair to you as a student of RGI. Include guidelines for Internet use during school hours, breaks, use of smartphones, and restrictions for using social media and unauthorized websites.

(c) Compile your findings in a report format.


Q3 (B) The performance of an algorithm can be determined in terms of its time and space complexity. Explain the difference between time complexity and space complexity and make a case for which is the most efficient method for determining the performance of an algorithm. [7 marks] 


LATEST TUTORIALS
APPROVED BY CLIENTS