Question

In: Computer Science

1) What are import libraries ? 2) What commands are found in the #include library that...

1) What are import libraries ? 2) What commands are found in the #include library that we will use ? 3) What is syntax ? 4) What does the computer do when it encounters a statement that Declares a variable ? 5) What are the byte sizes for int, double and char data types ? 6) Why is an int variable only able to store a range of values from approx -2.1 billion to +2.1 billion ? 7) What is PEMDAS ? How is it also important when doing math in a computer program ? 8) Is the ‘=’ sign the same for math and programming ? Explain your answer. 9) What happens when you Assign a value to a variable ? How does it work ? 10) What is variable Initialization, is it necessary in JAVA ?

Solutions

Expert Solution

The answer to the above question is:-

1.) Generally, in our code, there will be some cases where we want to print something on the screen. In that case, we will directly use System.out.print("hello");. Here we are calling "System.out.print()" function to print "hello" but we will not write the code for that function because it is "standard library function". Standard library functions are the functions to which we will not write the code but we will use their functionality directly by importing that package or class where that method will be present.

2.) for example in c we will use # include<stdio.h> After we include the header fIle, the C/C++
compiler goes to the standard library (generally it is available in tc/ lib) and searches for the header fIle there. When it finds the header fIle, it copies the entire header file content into the program where the #include statement is written.

3.)Syntax refers to the foundations that specify the proper combined sequence of symbols which will be accustomed type a properly structured program employing a given programing language. Programmers communicate with computers through the properly structured syntax, linguistics and synchronic linguistics of a programing language.

4.)Variables are used to store information, they also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. A variable can be thought of as a container to store information. The sole purpose is to label and store the data. This data can be used throughout the program. When a variable is declared some memory is allocated in the computer.

5.) Byte sizes:

int is 4 bytes

double is  8 bytes,

char is 2 bytes.

6.)Generally, for storing a number in billion it requires a memory of 4 bytes so int can store the value within 2.1 billion range.

7.)PEMDAS:- 5+3/5+3(4*5) how to calculate the value i,e., which operation should be done first. To answer those questions we will follow PEMDAS.

order of evaluation of the expression follows as:-

1.)P:- Parenthesis first

2.) E:- Exponents(i,e., powers and squares roots) next.

3.) M D:-Multiplication and Division (left to right), here multiplication and division rank equally so they go from left to right.

4.) A S:- Addition and Subtraction(left to right). Here addition and subtraction rank equally so they go from left to right.

8.)The usage of '=' is not the same in programming and math. In programming '=' is used to assign something to a variable.

Whereas in maths '=' is used to show two quantities are equal.

9.)Variable is a memory location so when we assign a value to a variable the value is stored in that memory location and we can access the value by that variable.

10.)Variable initialization means assigning a value to a variable. In java, variable initialization is some times necessary and sometimes not necessary. For instance and the boolean variable, it is not necessary to initialize. But for local variables, it is necessary to initialize them. Otherwise, the compiler will show an error message.

If any problem in understanding plz comment.


Related Solutions

Answer these questions regarding DNA libraries: In creating a genomic DNA library, what is the FIRST...
Answer these questions regarding DNA libraries: In creating a genomic DNA library, what is the FIRST step? a. Fragmenting the DNA into manageable pieces                b. Screening clones   c. Transforming recombinant DNA into bacteria d. Ligating DNA into plasmids   Sometimes artificial chromosomes (AC) constructed from bacterial (BACs) or yeast (YACs) DNA are used to harbor genomic DNA for libraries (e.g., the human genome project). Why are BACs/YACs often used instead of traditional plasmid DNA for the construction of genomic libraries?...
what is the following (ARDUINO): -Libraries are code that allow -Lcd. setCursor (x,y) -Where to Import...
what is the following (ARDUINO): -Libraries are code that allow -Lcd. setCursor (x,y) -Where to Import a library into a given code -Digital pins can be used to
Various libraries, like pThread.h (and its associated library) in C, give languages exposure to the underlying...
Various libraries, like pThread.h (and its associated library) in C, give languages exposure to the underlying system’s threading system. How does working with Grand Central Dispatch differ from other threading systems you have used (if you have never used threading, read up on Java threading for a comparison)? Be sure to talk about the activities that take place on the main thread versus those that take place on the background threads.
This question requires using Rstudio. This is following commands to install and import data into R:...
This question requires using Rstudio. This is following commands to install and import data into R: > install.packages("ISLR") > library(ISLR) > data(Wage) The required data installed and imported, now this is description of the data: This dataset contains economic and demographic data for 3000 individuals living in the mid-Atlantic region. For each of the 3000 individuals, the following 11 variables are recorded: year: Year that wage information was recorded age: Age of worker maritl: A factor with levels 1. Never...
This question requires using Rstudio. This is following commands to install and import data into R:...
This question requires using Rstudio. This is following commands to install and import data into R: > install.packages("ISLR") > library(ISLR) > data(Wage) The required data installed and imported, now this is description of the data: This dataset contains economic and demographic data for 3000 individuals living in the mid-Atlantic region. For each of the 3000 individuals, the following 11 variables are recorded: year: Year that wage information was recorded age: Age of worker maritl: A factor with levels 1. Never...
This question requires using Rstudio. This is following commands to install and import data into R:...
This question requires using Rstudio. This is following commands to install and import data into R: > install.packages("ISLR") > library(ISLR) > data(Wage) The required data installed and imported, now this is description of the data: This dataset contains economic and demographic data for 3000 individuals living in the mid-Atlantic region. For each of the 3000 individuals, the following 11 variables are recorded: year: Year that wage information was recorded age: Age of worker maritl: A factor with levels 1. Never...
Need to able to solve this method WITHOUT using ANY java libraries. ------------------------------ import java.util.Scanner; public...
Need to able to solve this method WITHOUT using ANY java libraries. ------------------------------ import java.util.Scanner; public class nthroot { public static void main(String[] args) { Scanner sc = new Scanner(System.in);    // Read n (for taking the nth root) int num = Integer.parseInt(sc.nextLine());    // Read number to take the nth root of int number = Integer.parseInt(sc.nextLine());    // Read the desired precision int precision = Integer.parseInt(sc.nextLine());    // Print the answer System.out.println(findnthRoot(number, num, precision)); }    private static String...
// note the different names for the C libraries #include <cstdio> // cstdio instead of stdio.h...
// note the different names for the C libraries #include <cstdio> // cstdio instead of stdio.h #include <cstdlib> // sstdlib instead of stdlib.h // a simple class to explore the ideas of: // data members // access modifiers of private, public // keyword static class LabExample { private: int storage; public: void setStorage (int s) { storage = s; // this->storage = s; } int getStorage () { // return storage; return this->storage; } void modStorage () { storage =...
Where to Import a library into a given code Digital pins can be used to Analog...
Where to Import a library into a given code Digital pins can be used to Analog pins can be used to AnalogReadSerial: What pins on the Arduino can be assigned as… The Arduino uses what to assign analog values? Examples of a standard Arduino library The Arduino uses a structured programming language-what type Channels of A/D conversion on the Arduino Uno The Arduino correlates temperature readings with what
Write a python function (Without using external libraries) to calculate the 1). determinate of a 2...
Write a python function (Without using external libraries) to calculate the 1). determinate of a 2 x 2 matrix 2). Calculate the inverse of a 2 x 2 matrix.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT