Questions
Write a program that reads in a single integer. Display a message depending on what is...

Write a program that reads in a single integer.

Display a message depending on what is given:

  • When the number is 42, output "42 is the Ultimate Question of Life, the Universe, and Everything."
  • When the number is 2020 output "2020 is the current year."
  • When the number is greater than 1000 and less than 3000 output "1500 could be a year." where 1500 is the number the user originally inputted
  • When none of the above, output "no idea."

One example shown below with the user input highlighted:

Give a number: 2020
2020 is the current year.
-- Font family -- -- Font size --

In: Computer Science

1. The following program has syntactic errors. Identify the errors and correct them. Compile the corrected...

1. The following program has syntactic errors. Identify the errors and correct them.

Compile the corrected program and submit a screeshot showing that the program has 0 (zero) errors.

You can use  https://repl.it/languages/c  or  https://www.onlinegdb.com/

#include <stdio.h>

int main (Void)

{

      INT sum;

      /* Compute result

      sum = 25 + 37 - 19;

      // Display result

      printf (“The answer is %i\n”, sum);

      return 0;

} // main

2. What is the purpose of a variable?

a.

To assign values

b.

To perform calculations

c.

To hold a value

d.

To hold a constant value

In: Computer Science

Data science use in construction required in typed words contain at least 1000 words

Data science use in construction

required in typed

words contain at least 1000 words

In: Computer Science

what aggregate functions priobably would be usefull to school administrators to analyze student population and why?...

what aggregate functions priobably would be usefull to school administrators to analyze student population and why? (school environment database management)

In: Computer Science

Iterative Process a. What is meant by the iterative development process? Briefly explain its key attributes...

Iterative Process

a. What is meant by the iterative development process? Briefly explain its key attributes and benefits .

b. What is the Agile Manifesto and what are some of its key values? explain at least 2 values in terms of their implications on the agile model.

In: Computer Science

NOTE give complete and accurate answers FOR 30 marks 1(a) A Give the output for the(2*5)...

NOTE give complete and accurate answers FOR 30 marks

1(a) A Give the output for the(2*5)

array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729])

a. a[:6:2] = -1000 (ii) a[ : :-1] )

b. Display the values of 1D array using for loop?


c. Write a code to print a 3D array?


d. How to print the transpose of a 2D array?


e Write a function to sort the array row and coloumn wise ?

(b) You are the class representative and your class advisor always requests your help to prepare the result analysis after each internal assessment. One of the tasks that your class advisor has assigned to you is to find whether a student has scored a 0 in a course.Given the scores of the 'n' students in the class, write a python program to find whether how many students have scored a zero in a course. Use arrays to store the marks of the students and assume that the maximum number of students in a class is 50.(5)

(c) Normally in all engineering colleges, there will be a long vacation after every even semester and a short vacation after every odd semester.Create a program in python to determine whether he will have a long vacation or short vacation at the end of a particular semester.(5)

(d) Design a 2D array to store the marks of six subjects of a student and display its total marks and average percentage?(5)

(e) Differentiate between VIEW and COPY?(5)

A Give the output for the(2*5)

array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729])

a. a[:6:2] = -1000 (ii) a[ : :-1] )

b. Display the values of 1D array using for loop?


c. Write a code to print a 3D array?


d. How to print the transpose of a 2D array?


e Write a function to sort the array row and coloumn wise ?

Q2. You are the class representative and your class advisor always requests your help to prepare the result analysis after each internal assessment. One of the tasks that your class advisor has assigned to you is to find whether a student has scored a 0 in a course.Given the scores of the 'n' students in the class, write a python program to find whether how many students have scored a zero in a course. Use arrays to store the marks of the students and assume that the maximum number of students in a class is 50.(5)

Q3 Normally in all engineering colleges, there will be a long vacation after every even semester and a short vacation after every odd semester.Create a program in python to determine whether he will have a long vacation or short vacation at the end of a particular semester.(5)

Q4 Design a 2D array to store the marks of six subjects of a student and display its total marks and average percentage?(5)

Q5 Differentiate between VIEW and COPY?(5)

A Give the output for the(2*5)

array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729])

a. a[:6:2] = -1000 (ii) a[ : :-1] )

b. Display the values of 1D array using for loop?


c. Write a code to print a 3D array?


d. How to print the transpose of a 2D array?


e Write a function to sort the array row and coloumn wise ?

Q2. You are the class representative and your class advisor always requests your help to prepare the result analysis after each internal assessment. One of the tasks that your class advisor has assigned to you is to find whether a student has scored a 0 in a course.Given the scores of the 'n' students in the class, write a python program to find whether how many students have scored a zero in a course. Use arrays to store the marks of the students and assume that the maximum number of students in a class is 50.(5)

Q3 Normally in all engineering colleges, there will be a long vacation after every even semester and a short vacation after every odd semester.Create a program in python to determine whether he will have a long vacation or short vacation at the end of a particular semester.(5)

Q4 Design a 2D array to store the marks of six subjects of a student and display its total marks and average percentage?(5)

Q5 Differentiate between VIEW and COPY?(5)

A Give the output for the(2*5)

array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729])

a. a[:6:2] = -1000 (ii) a[ : :-1] )

b. Display the values of 1D array using for loop?


c. Write a code to print a 3D array?


d. How to print the transpose of a 2D array?


e Write a function to sort the array row and coloumn wise ?

Q2. You are the class representative and your class advisor always requests your help to prepare the result analysis after each internal assessment. One of the tasks that your class advisor has assigned to you is to find whether a student has scored a 0 in a course.Given the scores of the 'n' students in the class, write a python program to find whether how many students have scored a zero in a course. Use arrays to store the marks of the students and assume that the maximum number of students in a class is 50.(5)

Q3 Normally in all engineering colleges, there will be a long vacation after every even semester and a short vacation after every odd semester.Create a program in python to determine whether he will have a long vacation or short vacation at the end of a particular semester.(5)

Q4 Design a 2D array to store the marks of six subjects of a student and display its total marks and average percentage?(5)

Q5 Differentiate between VIEW and COPY?(5)

A Give the output for the(2*5)

array([ 0, 1, 8, 27, 64, 125, 216, 343, 512, 729])

a. a[:6:2] = -1000 (ii) a[ : :-1] )

b. Display the values of 1D array using for loop?


c. Write a code to print a 3D array?


d. How to print the transpose of a 2D array?


e Write a function to sort the array row and coloumn wise ?

Q2. You are the class representative and your class advisor always requests your help to prepare the result analysis after each internal assessment. One of the tasks that your class advisor has assigned to you is to find whether a student has scored a 0 in a course.Given the scores of the 'n' students in the class, write a python program to find whether how many students have scored a zero in a course. Use arrays to store the marks of the students and assume that the maximum number of students in a class is 50.(5)

Q3 Normally in all engineering colleges, there will be a long vacation after every even semester and a short vacation after every odd semester.Create a program in python to determine whether he will have a long vacation or short vacation at the end of a particular semester.(5)

Q4 Design a 2D array to store the marks of six subjects of a student and display its total marks and average percentage?(5)

Q5 Differentiate between VIEW and COPY?(5)


This is a python assignment

In: Computer Science

Copy the following Python fuction discussed in class into your file: from random import * def...

Copy the following Python fuction discussed in class into your file:

from random import *
def makeRandomList(size, bound):
    a = []
    for i in range(size):
        a.append(randint(0, bound))
    return a

a. Add another function that receives a list as a parameter and computes the sum of the elements of the list. The header of the function should be

def sumList(a):

The function should return the result and not print it. If the list is empty, the function should return 0. Use a for loop iterating over the list.

Test the function in the console to see if it works.

b. Write a function that receives a list as a parameter and a value, and returns True if the value can be found in the list, and Falseif not. Use a for loop that goes over the list and compares each element to the value. If any of them is equal to the value, it returns True. Otherwise after the loop is done, you can return False. Thus, if the loop completes without a return statement happening, then the value is not in the list. The function header should look like this:

def searchList(a, val):

Test this second function a few times the same way as the first one.

c. Below the three functions, add a piece of code that

  • calls the function makeRandomList to generate a list with a size of 10 and a bound of 50, stores it in a variable, and prints it.
  • Then it should call the function sumList to compute the sum and also print the result.
  • Finally, it should ask the user for a value, input it and store it in a variable, then call the function searchList with the list and this variable, and output the result.

Test the program to make sure that it works fine.

In: Computer Science

How do i remove all javacript text from a block of text in python for example...

How do i remove all javacript text from a block of text in python

for example

Removal of any HTML tags – any text between a < character and a >you can assume is a HTML tag and needs to be removed.. Removal of JavaScript code – before you remove your HTML tags above, you will also need to remove any text that is between the <script> or </script> tags "Note that a <script> or </script>tag can have any amounts of whitespace or other text between the "" character and valid script tag that must be removed.

Im also not allowed to import any module form the python library

In: Computer Science

This is an exercise in correctly implementing insertion sort and selection sort. This assignment includes a...

This is an exercise in correctly implementing insertion sort and selection sort.


This assignment includes a text data file containing information on tutorial websites for a variety of programming languages. The data file is named Tutorials. It contains records of programming tutorial websites. The record structure for this text file is:


FIELD 1 = Programming Language

FIELD 2 = Name and Description of Website

FIELD 3 = URL Web Address of Language Tutorial


The structure of the file is that there is a separate line for each field/property/attribute of the record. Every three lines makes up one physical record.


For those of you who took computer science I here at CCP, you covered using a bubble sort to sort elements in a collection.


In your project, create two methods for the project – one that performs a selection sort on your Tutorial Website object array and one that performs an insertion sort on your Tutorial Website object array.


You should create a user defined object of Tutorial Website type. The object should have three properties:

Language Name
Website Description
Website URL

Your object will need to implement the comparable interface for this object. You may choose the property is used to determine the order of your object. Language name would be the best choice.


Your project should read the list of programming language tutorials in from the text data file, and load the data into a Tutorial Website object . In the process it should add the object into an array. After the array is fully loaded, print the list in unsorted order. sort the list in the array in ascending order using a Selection Sort Algorithm. After the list in the array is sorted in ascending order using the selection sort, print the list to the screen and write the list to CSV file. You should then sort the list in descending order using a Insertion Sort Algorithm. After the list in the array is sorted in ascending order using the selection sort, print the list to the screen and write the list to a CSV file in the project folder. After the list in the array is sorted in descending order using the Insertion sort, print the list to the screen and write the list to a CSV file in the project folder.

In: Computer Science

import javax.swing.*; public class MenuFrame extends JFrame { public MenuFrame() { setTitle("Menu Frame"); setSize(500, 500); MenuListenerExample...

import javax.swing.*;


public class MenuFrame extends JFrame {


public MenuFrame() {


setTitle("Menu Frame");

setSize(500, 500);

MenuListenerExample myMenu = new MenuListenerExample();


setJMenuBar(myMenu);

setLayout(null);

add(myMenu.textArea);


}


public static void main(String[] args) {

MenuFrame frame = new MenuFrame();

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);

}


}


import javax.swing.*;

import java.awt.event.*;


public class MenuListenerExample extends JMenuBar {


JMenu fileMenu, editMenu, helpMenu;

JMenuItem cut, copy, paste, selectAll;

JTextArea textArea;


public MenuListenerExample() {


cut = new JMenuItem("cut");

copy = new JMenuItem("copy");

paste = new JMenuItem("paste");

selectAll = new JMenuItem("selectAll");

textArea = new JTextArea();


cut.addActionListener(new MenuAction());

copy.addActionListener(new MenuAction());

paste.addActionListener(new MenuAction());

selectAll.addActionListener(new MenuAction());


fileMenu = new JMenu("File");

editMenu = new JMenu("Edit");

helpMenu = new JMenu("Help");


editMenu.add(cut);

editMenu.add(copy);

editMenu.add(paste);

editMenu.add(selectAll);

add(fileMenu);

add(editMenu);

add(helpMenu);


textArea.setBounds(30, 30, 430, 400);


}


private class MenuAction implements ActionListener {


public void actionPerformed(ActionEvent e) {

if (e.getSource() == cut) {

textArea.cut();

}

if (e.getSource() == paste) {

textArea.paste();

}

if (e.getSource() == copy) {

textArea.copy();

}

if (e.getSource() == selectAll) {

textArea.selectAll();

}

}

}

}



modify the above Java program to include the following: - When the user clicks on the help menu, a drop-down list will appear with an item called About, then when the user clicks on it, the window will show some instructions about the functionality of the menu, e.g, what the edit menu does, etc. - When the user clicks on the File menu, a drop-down list will appear with one item called Show Picture, and when the user clicks on it, a picture of your choice will appear.

In: Computer Science

Question 4 A. Suppose the following letter grade class has been defined globally in a program....

Question 4

A. Suppose the following letter grade class has been defined globally in a program.

#include <iostream>

using namespace std;

class Grade {

   private:

    char grade;

   public:

     Grade(char in_grade);

       void print( );

};

Grade::Grade ( char in_grade) {

       grade = in_grade;

}

void Grade::print ( ) {

        cout << grade;       

}

  

Write a main function that reads one character from the keyboard, create a Grade object containing that character, and then have the object print itself.

Furthermore, create an output file (named “output.txt”), and save the character to this output file. Last, close this output file.

  1. What is the output of the following C++ program ?  

int main ( )

{

      int a = 3, b= 2, c= 1, d, e, f, g;

      

      d = a&b;    e = a | c;   f = a >> 1, g = a << 1;

      cout << “d= “ << d << “ e = “ << e << “ f = “ << f << “g = “ << g << endl;

}

In: Computer Science

Consider the following variation of merge sort: split the list into thirds, sort each third, and...

Consider the following variation of merge sort: split the list into thirds, sort each third, and then merge all three sorted lists.

(a) Write pseudo-code for this sorting algorithm in python.

(b) Write a recurrence relation for the run-time of this algorithm, and use the master theorem to find the “big O” run time of the algorithm.

(c) How does the run time compare to the usual merge sort? Is this an improvement?

In: Computer Science

What is the Big-Oh notation of the following code snippet: BinarySearch(numbers, N, key) { mid =...

What is the Big-Oh notation of the following code snippet:

BinarySearch(numbers, N, key) {
    mid = 0;
   low = 0;
   high = 0;
   
   high = N - 1;
   
   while (high >= low) {
      mid = (high + low) / 2
      if (numbers[mid] < key) {
         low = mid + 1
      }
      else if (numbers[mid] > key) {
         high = mid - 1
      }
      else {
         return mid
      }
   }
   
   return -1   // not found
}

In: Computer Science

1. what is accessibility and assistive technology in web design? give one example for how assistive...

1. what is accessibility and assistive technology in web design? give one example for how assistive technology might support accessibility.

2. file formats like JPEG, GIF and PNG are supported by web browsers. which file format would you suggest be used to store the below given images? Expalain your reason for suggestion that particular file format

i) A picture of brightly coloured pigeon

ii) A railway network map showing routes between two towns

In: Computer Science

I need this in JAVA Lab9B In each method returned an integer. In this part of...

I need this in JAVA

Lab9B In each method returned an integer. In this part of the lab, all methods will have a void return type and take in an array of integers as a parameter. You’re going to write a program that creates a mini database of numbers that allows the user to reset the database, print the database, add a number to the database, find the sum of the elements in the database, or quit.

In main, you will declare an array of 10 integers (this is a requirement). Then you will define the following methods:

• printArray (int[ ] arr) – this takes in an array and prints it

• initArray (int[ ] arr) – this initializes the array so that each cell is 0

• printSum (int[ ] arr) – this calculates the sum of the elements in the array and prints it

• enterNum(int[ ] arr) – this asks the user for a slot number and value – putting the value into the array in the correct slot

• printMenu (int[ ] arr) – prints the menu in the sample output (that’s it, nothing more)

In main, create an array of 10 integers and immediately call initArray( ). Then, continuously looping, print the menu and ask the user what they want to do – calling the appropriate methods based on the user’s choice. Note that every time you call a method, you must pass the array that was created in main. If it makes it easier, we used a do-while loop and a switch statement in main. In our implementation, main was only 15 lines of code.

Sample output #1 Would you like to:

1) Enter a number

2) Print the array

3) Find the sum of the array

4) Reset the array

5) Quit

1

Enter the slot: 5

Enter the new value: 76

Would you like to: 1)

Enter a number 2)

Print the array 3)

Find the sum of the array 4)

Reset the array 5)

Quit

In: Computer Science