Question

In: Computer Science

Name the data type,value type and array size / name of the followings. 1) 20.4 2)...

Name the data type,value type and array size / name of the followings.

1) 20.4

2) a=5

3) [2 3 8]

4) ' 7 '

5) ' abc'

6) pi

7) b=true

8) 20+2i

9) [ 'a' 'b' 'c' ]

10) [ 'a' ; 'b' ]

11) [1 2 ;4 5;7 8]

12) [20,21,22,23]

13) c= [a;b]

14) c= [b:a]

15) d=[b:a ; b:a]

16) magic(3)

17 uint8(20)

18) int8(d)

Solutions

Expert Solution

1) 20.4 - It simply defines a Floating Point value.

2) a=5- It declares an integer value as 5 so that it can be used further for another calculations like shown below

3) [2 3 8] It simply creates a 1-d array having 1 row and 3 column i.e 1x3 Array with values- 2,3,8

4) ' 7 ' - Character

Since now it is written in between single quotes now it is not an integer now it has been defined as a character, That's why if we add directly 7+2 we get 7 but when we add '7' + '2' it adds ASCII values of character 7 and 2 i.e 55 ad 50 and gives us 105

5) ' abc'- Chacter Array with 3 elements, Basically charcter array is nothing but just a sequence of characters

6) pi - It is a function which gives a long floating point number which gives a nearest value of π.

7) b=true- It is used for boolean values or logical value,Where True gives logical value 1 and false gives value 0.

8) 20+2i- Complex Number

9) [ 'a' 'b' 'c' ]- It simply creates an array of characters.

10) [ 'a' ; 'b' ]- Now Here since we placed ; between two characters it will create them as two rows hence it created 2x1 array.

11) [1 2 ;4 5;7 8]- It Creates a 2D Array with 3 rows and 2 columns, in which elements of each row are entered one by one separated by semicolon ";".

12) [20,21,22,23]- It simply creates a 1-d array having 1 row and 3 column i.e 1x3 Array with values- 20,22,22,23

13) c= [a;b]- Now if a=2 and b=5, this instruction will create 2x1 array

14) c= [b:a]- Same here it will just create array with b in first row and a in second one.

15) d=[b:a ; b:a]- It gives a 2x0 empty double matrix.

16) magic(3)- Magic command creates a magic square array of size which is passed, in which sum of elements in a row or column or diagonally is same

So for magic(3) it creates a magic square array of size is (3,3)

Row-wise row 8+1+6=15 Column Wise 8+3+4=15 Diagonal 8+5+2=15

3+5+7=15 1+5+9=15 6+5+4=15

4+9+2=15 6+7+2=15

17 uint8(20)- It converts integer to 8 bit unsigned integer.

18) int8(d)- It gives Integer to 8 bit signed integer.


Related Solutions

Please enter a seed: 1 Please enter the size of the array: 1 Array size must...
Please enter a seed: 1 Please enter the size of the array: 1 Array size must be greater than 1. Please reenter: 0 Array size must be greater than 1. Please reenter: -1 Array size must be greater than 1. Please reenter: 12 Please choose an option: 1 Print the array 2 Find the average 3 Find the largest element 4 Count how many times 3 occurred 5 Count how many elements are less than half of the first element...
1) Write a function searchValue that accepts an array of integers, the size of the array,...
1) Write a function searchValue that accepts an array of integers, the size of the array, and an integer. Find the last occurrence of the integer passed in as an input argument in the array. Return the index of the last occurrence of the value. If the value is not found, return a -1 2) Write the line of code to call the previous function assuming you have an array vec with length n, and are looking for the number...
//   Given an array of size 9, with the values of 1-9, determine if the array...
//   Given an array of size 9, with the values of 1-9, determine if the array //   is valid or not. //   Display a message stating the row is VALId, or state its INVALID and what //   was the index number that determined the data invalid. // //   Use this java code as a start of your code. //   Test the array data by changing the values. //============================================================================= import java.util.*;    public class Soduko_ValidateRow    { public static void main(String...
1) Submit your completed dynamic array with template/generic data type (DArray.java) implementation. 2) Complete the template...
1) Submit your completed dynamic array with template/generic data type (DArray.java) implementation. 2) Complete the template DArray (if you have not done so) and this attached Iterator class. Make sure to document and test your code thoroughly. import java.util.Arrays; public class DArray { private final double GROW_FACTOR = 0.5;// array size growing rate //attributes private int size; private int buffer[]; //the actual array //constructors public DArray() { this.size=10; } public DArray(int size) throws Exception { if(size < 0) { throw...
Write a java code segment to declare an array of size 10 of type String and...
Write a java code segment to declare an array of size 10 of type String and read data for them from a file, prompt user for the file name. Data is stored in a file with 1 string per line.
Given an array of Student type and size 10, create a linked list of students by...
Given an array of Student type and size 10, create a linked list of students by linking students with an odd index first and then linking students with an even index. Write a loop to print out the students in the linked list #include<iostream> #include<string> #include<fstream> using namespace std; const int NUM = 10; struct Student{ string fName; string lName; Student * next; }; int main() {        Student stuArr[NUM];        ifstream myfile;        myfile.open("Test.txt");        for(int i = 0;...
You need a data structure that contains fields for name (char array), color (char array), age...
You need a data structure that contains fields for name (char array), color (char array), age (int), and height (int). Name the struct Info when you define it. Create a function named getUserInfo() that asks the user for name, color, age, and height and then returns a data structure containing that information. It should do the following: What is your name? George What is your favorite color? Green What is your age? 111 What is your height in inches? 72...
1-Write the reaction of acidic water with the followings: a-1-Methylcyclopentene b-1-ethyl-3-methylcyclohexene c-isobutene 2.Draw and name a...
1-Write the reaction of acidic water with the followings: a-1-Methylcyclopentene b-1-ethyl-3-methylcyclohexene c-isobutene 2.Draw and name a cyclic alkyne withasix membered ring.
Python 1.)Assume that name is a variable of type String that has been assigned a value....
Python 1.)Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is the last character of the value of name. So if the value of name were "Blair" the expression's value would be 'r'. 2.)Assume that word is a variable of type String that has been assigned a value. Write an expression whose value is a String consisting of the last three characters of the value of word. So if...
Write C++ program to do the following: 1. Create integer array size of 10 2. Ask...
Write C++ program to do the following: 1. Create integer array size of 10 2. Ask user input the values of the array's element using for loop 3. pass the array to void function. in void function do the following: a. Find the maximum of the array. b. Compute the element average c. Find out how many numbers are above the average d. Find out and print how many numbers are below the average e. find out how many numbers...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT