Mechanical A Rules

Are you coming to college on Friday?

Saturday, 10 September 2011

MIds Over!

YAY!!!! EXAMS ARE OVER!!!
Guys leave ur happiness in the form of comments on this page!

Wednesday, 31 August 2011

Chemistry Assignment 2- Answers

Questions
-----------

Q1) Write the Chemical equations for Lime Soda Process.

Q2) Write the differences b/w Lime Soda and Permutit Process.

Q3) Describe the Ion Exchange Process with neat diagram and reactions. Advantages and Disadvantages?

Q4) Write a short note on scales and sludges.

Q5) Differentiate b/w carbonate treatment and phosphate treatment.

Answers
---------
The answers to the first three questions can be found below.








Ill upload the next 2 answers in the next post.

Chemistry Assignment 2-Unit 2

Hey guys Im gonna post the answers for the Chem. Assignement.
Better get it done...god knows when its due!

Sunday, 28 August 2011

C assignment Q3

3Q) List all the various operations in C and explain in detail.

A) C has a wide range of operators. An arithmetic expression is composed of operators and operands. Operators act on operands to yield a result. Commonly used arithmetic operators are +, -, *, / and %.

The plus sign (+) is used to add two values, the minus sign (-) to subtract one value from another, the asterisk(*) to multiply two values, the division (/) to divide a value and the modulus (%) to obtain the reminder of integer division. These are known as binary operators since they operate on two values or variables.

Following are examples of arithmetic expressions :

    result = x - y;
    total = principle + interest;
    numsquare = x * x;
    celcius = (fahrenheit - 32) / 1.8

Notice the equal sign (=) in the above expressions, it is known as the assignment operator. It assigns the value on the right hand side of the equal sign to the variable on the left hand side.

In the last expression, parentheses are used to perform a certain operation first. This is because in C, operators follow a precedence rule. *, / and % have a higher precedence over + and -. Hence to override the precedence, parentheses should be used. Expressions having operators of the same precedence are generally evaluated from left to right. Another point to note is that in an expression which involves division, care should be taken to avoid a division by zero, since this results in infinity or an abnormal value. In Chapter 5 on control statements, we will see how a check can be done before a division occurs and prevent such operations.


Unary operator

A unary operator is one which operates on one value or operand. The minus sign (-) plays a dual role, it is used for subtraction as a binary operator and for negation as a unary operator. This operator has a precedence higher than the rest of the arithmetic operators.

result = -x * y;

in the above expression, if x has a value 20 and y has a value 2, then result will contain a negative value of 40 which is -40.

In C, some operators are a shorthand equivalent. These are increment (++) and decrement (--) operators. These can be pre-fixed or post-fixed. When these are pre-fixed to a variable in an expression, then the value is computed before the expression is evaluated. When these are post-fixed, the value is computed after the expression is evaluated.

Comma operator

Comma can be used in an expression. Each comma seperated expression is evaluated and the value of the rightmost expression will be returned.

Ternary operator

In C the ternary operator is the conditional expression operator.This accepts three operands. Question mark (?) and colon (:) are the two symbols used.

The format of the ternary operator is:

    condition ? expression1 : expression2

Example

    answer = (x < 1) ? 1 : x * x;
    line too long result is returned.

Consider another example which will clarify the usage of the ternary operator :

    max_value = (amount > value) ? amount : value;

Modulus operator

The Modulus operator is denoted by the symbol % (percentage sign). The operation performed using this operator is different from division. The remainder left when the first operand is divided by the second operand is returned as the result of the operation.

Logical operators

Logical operators in C are as per table 4.1

Table 4.1

&& Logical AND
|| Logical OR
! Unary NOT
Logical operators use true or false properties of expressions to return a true or false. True is represented by a non-zero value and false by zero. Logical operators are different from bitwise AND (&) and OR (|) operations (discussed in Chapter 11).

Consider the following expression :

result = q1 && q2; /* result is true if both q1 and q2 are non-zero */
result = q1 || q2; /* result is true if either q1 or q2 is non-zero */
result = !q1; /* result is true only if q1 is zero */

Precedence of operators

The precedence of an operator gives the order in which operators are applied in expressions: the highest precedence operator is applied first, followed by the next highest, and so on. The associativity of an operator gives the order in which expressions involving operators of the same precedence are evaluated. A list of operators, its precedence and associativity can be found in the Appendix.

Datatype conversions

C does implicit datatype conversion when the need arises. When a floating point value is assigned to an integer variable, the decimal portion is truncated. When a value 156.43 is assigned to an integer variable, 156 is stored and the decimal portion is discarded. If an integer 200 is assigned to a floating point variable, the value is converted to 200.000000 and stored.

Another point to remember is, whenever the two operands in an expression are integers, the operation is carried out using the rules of integer arithmetic. Hence any decimal portion resulting from a division operation will be ignored, even when the result is assigned to a floating point variable. This is demonstrated in program 4.6. If one of the operands is a floating point variable then floating point arithmetic will be followed.

C Assignment Question 2


2Q) What are data types and constants? Explain.

A)Computers are useful because of their ability to store and manipulate huge amounts of information. This information may be numbers, such as a financial report, or alphabetic characters like names and addresses. Managing this information requires the usage of programming languages. One of the important task of a programming language is identifying the type of data it is manipulating.
Data is stored in a computer's memory. The memory system comprises of uniquely numbered cells called memory addresses. We need to know the address where something is stored in order to retrieve it and work on it. A programming language frees us from keeping track of these memory addresses by substituting names for them. These names are called variables. Variables are descriptive names for the memory addresses.
Before we use a variable in C we must declare it. We must identify what kind of information will be stored in it. This is called defining a variable.Variables must be declared at the start of any block of code, but most are found at the start of each function. A variable must be defined to be one of the legal C data types. When a variable is defined it is not automatically initialized, it is the responsibility of the programmer to initialize this to a start value.

Variable names

All variable definitions must include two things variable name and its data type. Some rules to be followed in naming a variable in C are, it must start with an alphabet and can contain letter, underscores and digits. Both uppercase and lowercase letters can be used. Spaces should not be used in a variable name. Certain keywords like int, float, struct, if, while cannot be used as variable names. The variable names should not be very long and one should refer to the documentation of the C compiler to know the limitation. Generally the first eight characters of a variable name are significant.
Some of the valid variable names are :
fAmount
iTotal
iCounter
Note : The variable names should be meaningful and denote what the variable stores. As far as possible single letter variable names should be avoided.
C provides a number of data types, some of the basic types used are :
intinteger
charcharacter
floata floating point number
Table 3.1
There are variants to the above, such as
unsigned intunsigned integer
short intshort integer
long intlong integer
doubledouble precision floating point number
Table 3.2
When declaring variables to be of type long int, short int and unsigned int it is permissible to omit the keyword int. Since these variables must always be integers. Thus we can declare an unsigned integer counter as
unsigned counter;
Unlike in programming languages like Visual Basic, there is no datatype such as string in C. However you can declare an array of the datatype char and write functions to manipulate this.
The main difference among these data types is the amount of memory allocated for storing these. The maximum and minimum values that can be stored in these variables depends on the version of C and the computer system being used. Some of the typical values are :

Data TypeMaximumMinimumBytes
int32767-327682
unsigned int6553502
short32767-327682
long2147483647-21474836484
char (ASCII codes)127-1281
unsigned char25501
float3.4E+383.4E-384
double1.7E+3081.7E-3088

C Assignment Q&A


1) What is the history of C and its features?


A) The initial development of C occurred at AT&T Bell Labs between 1969 and 1973;[3] according to Ritchie, the most creative period occurred in 1972. It was named "C" because its features were derived from an earlier language called "B", which according to Ken Thompson was a stripped-down version of the BCPL programming language.
The origin of C is closely tied to the development of the Unix operating system, originally implemented in assembly language.


In 1978, Brian Kernighan and Dennis Ritchie published the first edition of The C Programming Language.[7] This book, known to C programmers as "K&R", served for many years as an informal specification of the language. Features of that language:
standard I/O library
long int data type
unsigned int data type
compound assignment operators of the form =op (such as =-) were changed to the form op= to remove the semantic ambiguity created by such constructs as i=-10, which had been interpreted as i =- 10 instead of the possibly intended i = -10
In 1983, the American National Standards Institute (ANSI) formed a committee, X3J11, to establish a standard specification of C. In 1989, the standard was ratified as ANSI X3.159-1989 "Programming Language C". This version of the language is often referred to as ANSI C, Standard C, or sometimes C89.


After the ANSI/ISO standardization process, the C language specification remained relatively static for some time. In 1995 Normative Amendment 1 to the 1990 C standard was published, to correct some details and to add more extensive support for international character sets. The C standard was further revised in the late 1990s, leading to the publication of ISO/IEC 9899:1999 in 1999, which is commonly referred to as "C99". 
C99 introduced several new features, including inline functions, several new data types (including long long int and a complex type to represent complex numbers), variable-length arrays, support for variadic macros (macros of variable arity) and support for one-line comments beginning with //, as in BCPL or C++. Many of these had already been implemented as extensions in several C compilers.
In 2007, work began in anticipation of another revision of the C standard, informally called "C1X". The C standards committee has adopted guidelines to limit the adoption of new features that have not been tested by existing implementations.
Current drafts of the C1X standard add numerous new features to C and the library, including type generic macros, anonymous structures, improved Unicode support, atomic operations, multi-threading, and bounds-checked functions. It also makes some portions of the existing C99 library optional, and improves compatibility with C++.

Tuesday, 23 August 2011

Pics

Sorry for those guys who are not in the pictures...Ill get everyone in ASAP!

Are you not understanding any of the classes?

When does Mech A want their sports periods? ( You can select more than one)

Which sport are you interested in playing?