Write a python code that calculates π using numpy rand function.
In: Computer Science
The ( ) method will be called if a method is called from within a subclass that overrides a super class method.
In Java the ( ) keyword is used to prevent changes being made to a variable.
The property of ( ) refers to the ability of an object to take on many forms.
In Java, a character constant’s value is its integer value in the ( ) character set.
An interface requires each of the interface’s methods to be ( ) or declared abstract.
The ( ) statement forces an exception object to be generated.
Through the process of ( ) , a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency.
Re-implementing an inherited method in a subclass to perform a different task from the parent class is called ( ) .
In a class definition, the special method that is called to create an instance of that class is known as a/an ( ) .
In Java, objects are passed as ( ) addresses.
List of words to choose from
Double, literal, overriding, bytecode, implemented, polymorphism, subclass, catch, protected, throws, constructor, interface, unicode, inheritance, int, overloading, memory, class, string, private, throw, main, extends, final, string literal, runtime, abstraction, prublic, jvm
In: Computer Science
Modify the bellow program by using only system calls to perform the task. These
system calls are open,read,write, and exit .Use text and binary files to test your programs.
#include <stdio.h>
void main(int argc,char **argv)
{
FILE *fp1, *fp2;
char ch, buf[20], *pos;
int n;
pos = buf;
if ((fp1 = fopen(argv[1],"r")) == NULL)
{
puts("File cannot be opened");
exit(1);
}
fp2 = fopen(argv[2], "w");
while ((n = fread(pos, sizeof(char), 20, fp1)) == 20)
{
fwrite(pos, sizeof(char), 20, fp2);
}
fwrite(pos, sizeof(char), n, fp2);
fclose(fp1);
fclose(fp2);
exit(0);
}
In: Computer Science
Convert the simple algebra below into Chomsky Normal Form (CNF), and then create a parse tree showing how the converted grammar could derive: x + y * z
E → E + T | T
T → T * F | F
F → (E) | x | y | z
In: Computer Science
What is an enumerated type in C? Define such a type (called chess_value) to store the
possible values of a chess piece – pawn, rook, knight, bishop, queen and king.
Create a structure called struct piece to store a chess piece. This structure should have two fields, one of which is the value of the piece, and should be of the enumerated type
defined in Q4. The second field is colour, which should be either 1 (white) or 0 (black).
Define an 8x8 array of "struct piece" pointers that can be used to model a chessboard. Each element of the array is pointer to a piece structure, that is either NULL if the square is empty or points to a relevant piece structure if it isn’t. Use malloc to allocate and setup both King pieces on the board. The white king should be placed in row 1, column 5, and the black king in row 8, column 5. You should leave all other squares as NULL.
In: Computer Science
In: Computer Science
Write a C++ program to play the dice game "Craps". Craps is one of the most popular games of chance and is played in casinos and back alleys throughout the world. The rules of the game are straightforward:
A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5, and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2, 3, or 12 on the first throw (called "craps"), the player loses (i.e. the "house" wins). If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then the sum becomes the player's "point." To win, you must continue rolling the dice until you "make your point." The player loses by rolling a 7 before making the point.
At a minimum, your solution must contain the functions below.
void displayGameRules()
int rollOneDice()
int rollTwoDice()
Write a program that implements craps according to the above rules. Additionally:
In: Computer Science
R-Studio (R Programming Language)
1. How would you create a vector `V` containing the values 0,
0.25, 0.5, 0.75, and 1?
```{r}
#insert your code
```
2. Name the elements of `V`: first, second, middle, fourth, last.
Describe two ways of naming elements in `V`
```{r}
#insert your code
```
3. Suppose you keep track of your mileage each time you fill up.
At your last 6 fill-ups the mileage was
65311 65624 65908 66219 66499 66821 67145 67447. Enter these
numbers into R as vector `miles`. Use the function `diff` on the
data `miles`. What does it give? Use `sum` on the computed
differences to find the total travelled distance.
```{r}
#insert your code
```
In: Computer Science
Argue analytically that a completely impure node yields the highest Gini Impurity.
In: Computer Science
6)True/False with explanations:
a.In KNN, the complexity of the model space can be tuned to account
for more complex decision boundaries by decreasing K.
b.If Margin(Model 1)>Margin(Model 2) on the same data, Model 1
will perform better on unseen data.
c.Perceptron minimizes training error when the data is linearly
separable.
In: Computer Science
Assume thatthe table EMP hasthe following data EmpNo Surname Firstname 1 Smith Fred 2 Jay Emma 2 Phelps Mark Consider the following statement: SELECT Firstname || ' ' || Surname FROM Employee What is displayed?
In: Computer Science
Docker containers can be considered a new era of virtualization that has fundamentally changed the IT industry. For this discussion question, provide a brief response that describes a Docker container and how a container differs from a hypervisor.
In: Computer Science
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words
Question 4: Recall the problem in which you have k sorted array each of size n, which need to make one single sorted array. Find another fast way to unite the arrays that does not use Priority Queue.
In: Computer Science
Remarks: In all algorithm, always explain how and why they work. If not by a proof, at least by a clear explanation. ALWAYS, analyze the running time complexity of your algorithms. In all algorithms, always try to get the fastest possible. A correct algorithm with slow running time may not get full credit. Do not write a program. Write pseudo codes or explain in words
Question 5: Five an efficient data structure supporting the following operations. Insert(S, x), Delete−M ax(S), and Delete−1000 th(S) which deletes from H the 100 largest element in the structure. Assume that the number of elements is more than 100. Also assume that the numbers are pairwise distinct and so the 100”th largest element is well defined.
In: Computer Science
Write a response to the following in a minimum of 175
words.
What is virtualization and its benefits?
Why has virtualization become almost necessary in today's business
environment? Other than the cost of hardware and the lack of effort
required to virtualize software, why businesses might decide to use
virtualization?
In: Computer Science