Arrays and Library Functions

Size: px
Start display at page:

Download "Arrays and Library Functions"

Transcription

1 Arrays and Library Functions Page 1 of 13 Starting address Arrays: - An array is a collection of variables of the same type that are referenced by a common name. It consists of contiguous memory locations. Need for arrays:- For large applications or calculations say to find the average marks of 50 students if we use 50 different variables the job will be cumbersome and tedious and program maintenance will be very difficult. But if we use array the remembering and managing these variables will be easy. To make the program complex free and more understandable array is used. Declaration of arrays: Syntax:- data-type array-name[size]; For ex:- int A[10]; float B[20]; char C[30]; where data-type refers to any fundamental(or primitive or in-built) data types, array-name will be any valid identifier name and size will be any number which indicates no. of elements the array contains. Types of Arrays:- Arrays are of two types:- (i) one-dimensional arrays and (ii) Twodimensional arrays. Both the arrays can be of numeric as well as character (or string) types. (i) One-dimensional (or single dimensional or 1-D) arrays:- It is a collection of similar types of elements referenced by a common name. The elements of the are referred by their subscripts or indices. For eg. int A[5]; The above array will be having elements : A[0], A[1], A[2], A[4], A[5]. Array subscripts ( the numbers which are within [ ] ) always starts with number 0 not 1 in C++. Subscripts are the locations of the elements within the array. Memory representation of 1-D array Let us take the above example which is int A[5]; A[0] A[1] A[2] A[3] A[4] Where A[0] is the first element, A[1] is the second element and so on. The last element (i.e. 10 here) always having location A[size-1]. Each element contains 2 bytes of memory. The address of first element of the array i.e. &A[0] is called the base address of the array. Note:- The name of the array (here A) is a pointer to its base address i.e. first element s address (i.e. &A[0]). Size of the array in memory = data-type X size of the array For the above array the memory occupied will be 2 X 5 = 10 bytes. We can find it using C++ coding also cout << sizeof(a); here sizeof is a operator which is used to find the size of any data type, variable or derived data type in bytes and A is the array name. Initialization of One-dimensional array (Numeric type):- There are two types of initialization (i) Sized array initialization and (ii) unsized array initialization (i) Sized array initialization :- It can be done during the program writing (i.e. before program execution) or during the program execution (Using Loop). For ex:- int A[5] = 12, 13, 20, 5, 2; Location value

2 float B[4] = 3.4, 4.5, 6.2, 7.8; This is sometimes called direct initialization. Page 2 of 13 code segment: int A[5]; for( int i=0; i<5; i++) cin >> A[i]; Here the values must be provided by the user during the execution of the program. In the first case the values are actually assigned during the compilation time and in the second case the values are assigned during the execution time by the user s input. (i) Unsized array initialization :- It can only be done in following ways: int A[ ] = 2, 5, 17, 10, 12; // No size is given within [ ] char str[ ] = Kendriya Vidyalaya ; The compiler will automatically fixed the size of the array. Here the advantage is that the number of elements can be increased or decreased without considering the size. It is more flexible whenever there is a requirement of direct initialization or the values are known to the user. String as an array:- C++ does not string data types rather it implements string as onedimensional character arrays. String is defined as a array of characters that is terminated by a null character \0. For ex:- char str[20] = Kendriya Vidyalaya ; It can be represented as Location in the array str[0] str[8] str[18] K e n d r i y a V i d y a l a y a \0 The above array contains 18 characters, but it can contain maximum of 19 characters i.e. size 1 characters and one space is reserved for null character. Here the length of the array is 18. The position of null character is not taken for finding the length of the array. (i) Two-dimensional (2-D) arrays:- A two-dimensional array is a multi one-dimensional arrays. It consists of rows and columns i.e. it is in a matrix format. For instance an array A[m][n] is an m by n table with m rows and n columns containing m X n elements. The no. of elements = no. of rows X no. of columns One of the use of 2-D numeric array is matrix manipulation which is one of the important concept of mathematics. Declaration of 2-D array: The general form of a two-dimensional array is Syntax:- Data-type array-name [rows] [columns]; Where data-type is any base data type, array-name is any valid identifier name and rows, the first index indicates the no. of rows and columns the second index, indicates the no. of columns. For ex:- int Price [4] [5]; The array Price have 4 elements Price[0], Price[1],., Price[3] which itself an int array with 5 elements. The individual elements of Price are referred to as Price[0][0], Price[0][1],., Price[0][3], Price[1][0], Price[1][1] and so forth. The last element will be Price [3][4]. Memory Map Representation :- Ex:- int Price [4][5];

3 Page 3 of 13 Columns n-1 Rows m = rows, n = columns m-1 3 Price [1] [1] Price [3][4] Size occupied by the above array in memory = data-type X rows X columns = 2 X 4 X 5 = 40 bytes C++ statement will be : cout << sizeof(price); Array of Strings:- The two-dimensional character array is known as array of strings. The size of the first index (rows) is the number of strings and the size of the second index (columns) is the maximum length of each string. For ex:- char days [7][11]; Declares an array of 7 strings each of which can hold maximum of 10 valid characters where 1 extra to take care of the null character \0 ; (7) The above array of strings appears in memory as shown below: (11) M O N D A Y \0 1 T U E S D A Y \0 2 W E D N E S D A Y \0 3 T H U R S D A Y \0 4 F R I D A Y \0 5 S A T U R D A Y \0 6 S U N D A Y \0 Array Initialization:- Like One-dimensional array two-dimensional array can be initialized in two ways:- (i) Sized 2-D array initialization int SQ[3][2] = 1, 1, 2, 4, 3, 9 ; int SQ[3][2] = 1,1, 2,4, 3,9;

4 For Array of strings: Char Months[12][4] = Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec ; (i) Unsized 2-D array initialization Page 4 of 13 int Cube[ ][2] = 1, 1, 2, 8, 3,27, 4, 64 ; - - rows should be left blank Char Months[ ][4] = Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec ; The advantage is that one can increase the rows as and when required. In C++ program nested loop is required for taking inputs for numeric type 2-D arrays whereas generally single loop is used for taking inputs in character type 2-D arrays (i.e. for array of strings). For string input gets ( ) function (which is defined in stdio.h header file) is normally preferred over cin>> operator since it can able to take the white space characters (tabs, spaces etc). Code segment: columns int Mat[4][5]; for (int i = 0; i < 4; i++) -- Nested loop for (int j = 0; j < 5; j++) cin >> Mat[i][j]; -- Here i indicates rows & j indicates char days [7][11]; for (int i = 0; i < 7; i++) gets(days[i]); //Q1. Write a program to display the multiplication of two matrices #include<iostream.h> #include<conio.h> clrscr(); int A[50][50],B[50][50],C[50][50]; int r1,c1,r2,c2,i,j,k; cout<<"\nenter the rows & columns for matrix A:"; cin>>r1>>c1; cout<<"\nenter the rows & columns for matrix B:"; cin>>r2>>c2; cout<<"\nenter the elements for matrix A:\n"; for(i=0;i<r1;i++) for(j=0;j<c1;j++) cout<<"element"<<i<<","<<j<<":"; cin>>a[i][j]; cout<<"\nenter the elements for matrix B:\n"; for(i=0;i<r2;i++) for(j=0;j<c2;j++) cout<<"element"<<i<<","<<j<<":"; cin>>b[i][j];

5 if(c1!=r2) cout<<"matrix multiplication is not possible!"; getch(); return; else cout<<"multiplication is possible!"; //Multiplication for(i=0;i<r1;i++) for(j=0;j<c2;j++) C[i][j]=0; for(k=0;k<r2;k++) C[i][j]+=A[i][k]*B[k][j]; cout<<"\nmatrix A:\n"; for(i=0;i<r1;i++) cout<<"\n"; for(j=0;j<c1;j++) cout<<a[i][j]; Page 5 of 13 cout<<"\nmatrix B:\n"; for(i=0;i<r2;i++) cout<<"\n"; for(j=0;j<c2;j++) cout<<b[i][j]; cout<<"\nproduct Matrix C:\n"; for(i=0;i<c1;i++) cout<<"\n"; for(j=0;j<r2;j++) cout<<c[i][j]; getch(); call by value & call by reference A function can be invoked in two ways: call by value and call by reference Call by value In call by value method the values of actual parameters (the parameters that appear in a function call statement i.e. the original values) are copied into the formal parameters (i.e. the parameters that appear in function definition). Here the called function creates its own copy of argument values for the original Call by reference In call by reference a reference to the original variable is passed. A reference is an alias (i.e. a different name) for a predefined variable. This means the original values are referred here. Here the called function does not creates its own copy of original values, rather, it refers to the original values only by different names

6 values and uses them i.e. it works with the duplicate data(s). In this method if there is any change(s) occurred in the parameter(s), are not reflected back to the original values. Page 6 of 13 i.e. the references i.e. it works with the original data(s). In this method if any change(s) occurred in the parameter(s), are reflected back to the original values. Example of call by value method:- #include<iostream.h> #include<conio.h> clrscr(); void change(int); //prototype declaration int n; cout<<"\n Enter any number:"; cin>>n; cout<<"\noriginal value="<<n<<endl; change(n); // function call cout<<"\nvalue after function call="<<n<<endl; getch(); //function definition void change(int n1) n1 = n1 + 5; //number is incremented by 5 cout<<"\nvalue in function definition="<<n1; Output: Enter any number:5 original value=5 Value in function definition=10 Value after function call=5 // Here the changes are not reflected Example of call by reference method:- #include<iostream.h> #include<conio.h> clrscr(); void change(int &); //prototype declaration (see the syntax) int n; cout<<"\n Enter any number:"; cin>>n; cout<<"\noriginal value="<<n<<endl; change(n); // function call cout<<"\nvalue after function call="<<n<<endl; getch(); //function definition void change(int &n1) n1 = n1 + 5; //number is incremented by 5 cout<<"\nvalue in function definition="<<n1;

7 Page 7 of 13 Output: Enter any number:5 original value=5 Value in function definition=10 Value after function call=10 //Here the changes are reflected Note: The parameters are also known as arguments. Reference Variables:- Reference variables are the variables which refer to other variables by a different name. If we want to create another name of any variable then we have to use reference variables; For ex:- int a =10; int &b = a; 0x8fc9fff4 10 Both refer to the same memory area Where 10 is stored. a b Passing arrays to functions (numeric & string) Numeric array and string array can be passed as an argument to functions. Whenever we want to pass a numeric array as an argument to functions we have to provide the array name (Since it is pointer to its base address i.e. holds the starting address of the array) along with its size. But in case of character array (i.e. for strings) we need to provide only the array name. This is because the string is terminated by null character in C++ so the size of the string is automatically understandable by the compiler. Let us take examples to illustrate this: Q To display the highest & lowest marks of 10 students in a particular subject using array as an argument to a function #include<iostream.h> #include<conio.h> void ArrHL(int [ ],int); // prototype declaration int A[10],i; cout<<"\nenter the subject marks:\n"; for(i=0;i<10;i++) cout<<"marks "<<i+1<<":"; cin>>a[i]; ArrHL(A,i); //function call getch(); void ArrHL(int A1[],int n) //arguments are int array A and its size // [ ] indicates it can any size int H,L; for(int i=0;i<n;i++)

8 L=A1[0]; H=A1[0]; if(a1[i]>h) H=A1[i]; if(a1[i]<l) L=A1[i]; cout<<"\nhighest Number="<<H<<endl; cout<<"\nlowest Number="<<L; output Enter the subject marks: marks 1:2 marks 2:6 marks 3:8 marks 4:121 marks 5:17 marks 6:19 marks 7:0 marks 8:23 marks 9:25 marks 10:29 Page 8 of 13 Highest Number=29 Lowest Number=2 Q. To find the reverse of a string and its length by passing a character array in a function. #include<iostream.h> #include<conio.h> #include<stdio.h> clrscr(); int strlencount(char []); // prototype declaration char str[31]; cout<<"\nenter the string:"; gets(str); cout<<"\nstring Length= "<<strlencount(str); //function call getch(); int strlencount(char str1[]) //argument is char array int len=0,i; for(i=0; str1[i]!='\0'; i++) len++; for(i=len-1;i>=0;i--) cout<<str1[i]; //We can also write cout<<str; return len; Note: - Similarly 2-D array can also be passed as an argument to an array. Library Functions

9 Library is a collection of subprograms used to develop other programs and software. The C++ library of functions stores functions of same category e.g. mathematical functions, string functions, character functions etc. under separate files known as header files. Header files provide function prototypes, definitions for library functions. Mathematical functions Header File (math.h) Page 9 of 13 SL. NO. Function Prototype (General Form) 1 exp double exp(double arg) 2 pow double pow(double arg1, double arg2) 3 sqrt double sqrt (double num) 4 fabs double fabs (double num) 5 log 10 double log10(double num) 6 log double log(double num) 7 fmod double fmod(double x, double y) Description The exp( ) function returns the natural logarithm e raised to the arg power. The pow( ) function returns arg1 raised to arg2 power i.e. arg1 arg2. A domain error occur if arg1 = 0 and arg2 <= 0. Also if arg1 < 0 and arg2 is not an integer. The sqrt( ) function returns the square root of num. if num < 0 domain error occurs. The fabs ( ) function returns the absolute value of num. The log10( ) function returns the base 10 logarithm for num. A domain error occurs if num is negative and a range error is occurs if the argument num is zero. The log( ) function returns the natural logarithm for num. A domain error occurs if num is negative and a range error is occurs if the argument num is zero. The fmod( ) function returns reamainder of the division x/y. Example exp(2.0) gives 2 the value e. pow(3,2) gives 9. pow(3.0,0) gives 1. pow(4.0,2.0) gives 16. sqrt(9) gives 3 sqrt(81.0) gives 9. 0 fabs(2.0) gives fabs(-3) gives 3. log 10(1.0) gives base 10 logarithm for 1.0 log (1.0) gives natural logarithm for 1.0 fmod(10.0,4.0) returns 2.0 Note:- abs ( ) function is used to find the absolute value for integer numbers and mod( ) function is used to find the remainder when one integer is divided by another integer number. String functions Header file string.h SL. NO. Function Description Example 1 strcpy(s1,s2) This function copies character strcpy( Vidyalaya, string s2 to string s1. The s1 Kendriya ) will give Kendriya. must have enough reserved elements to hold the string s2. 2 strcat(s1,s2) This function concatenates strcat( Computer, Science ) (merges) two strings. The will give ComputerScience. string s2 will be added at the end of string s1. The array s1

10 must have enough reserved elements to hold the string s2. 3 strcmp(s1,s2) This function compares the strings s1 with s2 on an alphabetic element by element basis.if s1>s2 then it return 1 if s1=s2 it return 0 And if s1<s2 it return -1 Strcmp( KVS, KBS ); It will return -1 Page 10 of 13 Character functions Header File - ctype.h Function Description Example int isalnum(int,c) This functions returns nonzero value if its Argument c is a letter or digit, if the character is not an alphanumeric then it char c= A if (isalnum( c)) cout<< Alphanum ; returns zero. int isalpha(int,c) This functions returns nonzero value if its Argument c is a alphabet if the character is not an alphanumeric then it returns zero. int isalnum(int,c) This functions returns nonzero value if its Argument c is a digit, if the c is not digit then it returns zero. int islower(int,c) This functions returns nonzero value if its Argument c is in lowercase letter, otherwise it returns zero. int isupper(c) This functions returns nonzero value if its Argument c is in uppercase letter, otherwise it returns zero. int toupper(int,c) This functions returns uppercase equivalent of c if c is already in upper case it remains unchange. int tolower(int,c) This functions returns lowercase equivalent of c if c is already in lower case case it remains unchanged. Questions Array if (isalpha( c)) cout<< Alphabet ; if (isdigit( c)) cout<< Digit ; 1. Write a program in C++ to interchange the values of the row and column. if (islower( c)) cout<< Lower case ; if (isupper( c)) cout<< Upper case ; Char c= a cout<<toupper(c); output A Char c= A cout<<tolower(c); output a 2 Write a user define function xyz() which takes a two dimensional array with size N rows and N columnsas argument and store all 1)even in one dimensional array2) All odd in one dimensional array 3. display product of all the number except those which are not divisible by either 5 or write a user define function unitdigit() which takes a two dimensional array with size N rows and M columns as argument and store all i) unit digit ii) except unit digit In two dimensional array. i.e A[2][3] = Resultant array should be i) A[2][3] = ii) A[2][3] = Write a user define function repeat() which takes a two dimensional array with size N rows and M columns as argument and convert all repeated element into zero.

11 Page 11 of Write a user define function convert() which takes a one dimensional array with size N as argument and convert it into two dimensional array. Suppose arr[6]= 1,2,3,4,5,6 Resultant array should be Arr[6][6] = Write a function in C++ to replace the repeating elements in an array by 0. The zeros should be shifted to the end. Do not use parallel array. The order of the array should not change. ( 2 ) Eg : Array : 10, 20, 30, 10, 40, 20, 30 Result : 10, 20, 30, 40, 0, 0, 0 7. Write a function in C++ called shift( ) to rearrange the matrix as shown. Do not use parallel matrix. ( 2 ) Original Matrix Rearranged Matrix Find the output of the following program: #include <iostream.h> void modify(int arr[ ], int N) for (int I=1;I<N;I++) arr[ I-1]+=arr[ I ]; int P[]=1,2,3,4,Q[]=5,10,15,20,30; modify(p,4); modify(q,5); for (int L=0;L<4;L++) cout<<p[l]<< $ ; cout<<endl; for (L=0;L<5;L++) cout<<q[l] << $ ; cout<<endl; 9. Find the output of the following program: #include <iostream.h> int a=5;

12 void sample( int &x, int y, int *z) a+=x; y*=a; * z=a+y; cout<<a<< <<x<< << y<< <<*z<< \n ; clrscr(); int a =7,int b = 5 ; sample(::a, a, &b); cout<< ::a << << a << <<b << \n ; sample(::a, a, &b); cout<< ::a << << a << <<b << \n ; Page 12 of Write a function in C++ to add new objects at the bottom of a binary file TICKET.DAT, assuming the binary file is containing the objects of the following class. class LOTTERY int LotTicNo; char StateCode[5]; public: void Enter()cin>>LotTicNo;gets(StateCode); void Display()cout<<LotTicNo<<StateCode<<endl; ; 1 1. Write a function in C++ that will read the contents of a file EXAM.DAT and display the details of those students whose marks>75. The binary file EXAM.DAT containing records of student. 2 class student char roll [4]; char name[20]; int marks; public : void Read_Data ( ) ; // Entering data in to the file void Show_Date ( ); //Displaying the content of the file 1 2. Find the output of the following program. Assume that all required headers files have been included. 2 int funs (int &x, int y=10) if (x%y == 10) return ++x; else return y-- ; void main( ) int p=20, q=23; q = funs(p,q); cout <<p<< ; <<q<< endl; q = funs(p);

13 cout <<p<< ; <<q<<endl; Page 13 of 13

AT&T Global Network Client for Windows Product Support Matrix January 29, 2015

AT&T Global Network Client for Windows Product Support Matrix January 29, 2015 AT&T Global Network Client for Windows Product Support Matrix January 29, 2015 Product Support Matrix Following is the Product Support Matrix for the AT&T Global Network Client. See the AT&T Global Network

More information

LIC MANAGEMENT SYSTEM

LIC MANAGEMENT SYSTEM LIC MANAGEMENT SYSTEM C++ PROJECT REPORT M.S.Ramaiah Institute of Technology Dept. of Electronics and Instrumentation Engineering Submitted to: S.Elavaar Kuzhali Assistant Professor Submitted By: Pushkarini.R.K

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

More information

Data Structures using OOP C++ Lecture 1

Data Structures using OOP C++ Lecture 1 References: 1. E Balagurusamy, Object Oriented Programming with C++, 4 th edition, McGraw-Hill 2008. 2. Robert Lafore, Object-Oriented Programming in C++, 4 th edition, 2002, SAMS publishing. 3. Robert

More information

Passing 1D arrays to functions.

Passing 1D arrays to functions. Passing 1D arrays to functions. In C++ arrays can only be reference parameters. It is not possible to pass an array by value. Therefore, the ampersand (&) is omitted. What is actually passed to the function,

More information

Chapter 5 Functions. Introducing Functions

Chapter 5 Functions. Introducing Functions Chapter 5 Functions 1 Introducing Functions A function is a collection of statements that are grouped together to perform an operation Define a function Invoke a funciton return value type method name

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

COMPUTER SCIENCE 1999 (Delhi Board)

COMPUTER SCIENCE 1999 (Delhi Board) COMPUTER SCIENCE 1999 (Delhi Board) Time allowed: 3 hours Max. Marks: 70 Instructions: (i) All the questions are compulsory. (ii) Programming Language: C++ QUESTION l. (a) Why main function is special?

More information

Arrays. number: Motivation. Prof. Stewart Weiss. Software Design Lecture Notes Arrays

Arrays. number: Motivation. Prof. Stewart Weiss. Software Design Lecture Notes Arrays Motivation Suppose that we want a program that can read in a list of numbers and sort that list, or nd the largest value in that list. To be concrete about it, suppose we have 15 numbers to read in from

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) CHARTERED BANK ADMINISTERED INTEREST RATES - PRIME BUSINESS*

COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) CHARTERED BANK ADMINISTERED INTEREST RATES - PRIME BUSINESS* COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) 2 Fixed Rates Variable Rates FIXED RATES OF THE PAST 25 YEARS AVERAGE RESIDENTIAL MORTGAGE LENDING RATE - 5 YEAR* (Per cent) Year Jan Feb Mar Apr May Jun

More information

COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) CHARTERED BANK ADMINISTERED INTEREST RATES - PRIME BUSINESS*

COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) CHARTERED BANK ADMINISTERED INTEREST RATES - PRIME BUSINESS* COMPARISON OF FIXED & VARIABLE RATES (25 YEARS) 2 Fixed Rates Variable Rates FIXED RATES OF THE PAST 25 YEARS AVERAGE RESIDENTIAL MORTGAGE LENDING RATE - 5 YEAR* (Per cent) Year Jan Feb Mar Apr May Jun

More information

Stacks. Linear data structures

Stacks. Linear data structures Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

More information

Case 2:08-cv-02463-ABC-E Document 1-4 Filed 04/15/2008 Page 1 of 138. Exhibit 8

Case 2:08-cv-02463-ABC-E Document 1-4 Filed 04/15/2008 Page 1 of 138. Exhibit 8 Case 2:08-cv-02463-ABC-E Document 1-4 Filed 04/15/2008 Page 1 of 138 Exhibit 8 Case 2:08-cv-02463-ABC-E Document 1-4 Filed 04/15/2008 Page 2 of 138 Domain Name: CELLULARVERISON.COM Updated Date: 12-dec-2007

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

13 Classes & Objects with Constructors/Destructors

13 Classes & Objects with Constructors/Destructors 13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.

More information

arrays C Programming Language - Arrays

arrays C Programming Language - Arrays arrays So far, we have been using only scalar variables scalar meaning a variable with a single value But many things require a set of related values coordinates or vectors require 3 (or 2, or 4, or more)

More information

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists Lecture 11 Doubly Linked Lists & Array of Linked Lists In this lecture Doubly linked lists Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for a Sparse

More information

Answers to Review Questions Chapter 7

Answers to Review Questions Chapter 7 Answers to Review Questions Chapter 7 1. The size declarator is used in a definition of an array to indicate the number of elements the array will have. A subscript is used to access a specific element

More information

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language Simple C++ Programs Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input and Output Basic Functions from

More information

6.170 Tutorial 3 - Ruby Basics

6.170 Tutorial 3 - Ruby Basics 6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you

More information

Chapter One Introduction to Programming

Chapter One Introduction to Programming Chapter One Introduction to Programming 1-1 Algorithm and Flowchart Algorithm is a step-by-step procedure for calculation. More precisely, algorithm is an effective method expressed as a finite list of

More information

Number Representation

Number Representation Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

More information

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters

More information

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 3: Input/Output Objectives In this chapter, you will: Learn what a stream is and examine input and output streams Explore

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

Analysis One Code Desc. Transaction Amount. Fiscal Period

Analysis One Code Desc. Transaction Amount. Fiscal Period Analysis One Code Desc Transaction Amount Fiscal Period 57.63 Oct-12 12.13 Oct-12-38.90 Oct-12-773.00 Oct-12-800.00 Oct-12-187.00 Oct-12-82.00 Oct-12-82.00 Oct-12-110.00 Oct-12-1115.25 Oct-12-71.00 Oct-12-41.00

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

Unit 1. 5. Write iterative and recursive C functions to find the greatest common divisor of two integers. [6]

Unit 1. 5. Write iterative and recursive C functions to find the greatest common divisor of two integers. [6] Unit 1 1. Write the following statements in C : [4] Print the address of a float variable P. Declare and initialize an array to four characters a,b,c,d. 2. Declare a pointer to a function f which accepts

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

AP Computer Science Java Mr. Clausen Program 9A, 9B

AP Computer Science Java Mr. Clausen Program 9A, 9B AP Computer Science Java Mr. Clausen Program 9A, 9B PROGRAM 9A I m_sort_of_searching (20 points now, 60 points when all parts are finished) The purpose of this project is to set up a program that will

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

I PUC - Computer Science. Practical s Syllabus. Contents

I PUC - Computer Science. Practical s Syllabus. Contents I PUC - Computer Science Practical s Syllabus Contents Topics 1 Overview Of a Computer 1.1 Introduction 1.2 Functional Components of a computer (Working of each unit) 1.3 Evolution Of Computers 1.4 Generations

More information

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements 9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

Enhanced Vessel Traffic Management System Booking Slots Available and Vessels Booked per Day From 12-JAN-2016 To 30-JUN-2017

Enhanced Vessel Traffic Management System Booking Slots Available and Vessels Booked per Day From 12-JAN-2016 To 30-JUN-2017 From -JAN- To -JUN- -JAN- VIRP Page Period Period Period -JAN- 8 -JAN- 8 9 -JAN- 8 8 -JAN- -JAN- -JAN- 8-JAN- 9-JAN- -JAN- -JAN- -JAN- -JAN- -JAN- -JAN- -JAN- -JAN- 8-JAN- 9-JAN- -JAN- -JAN- -FEB- : days

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

More information

Moving from C++ to VBA

Moving from C++ to VBA Introduction College of Engineering and Computer Science Mechanical Engineering Department Mechanical Engineering 309 Numerical Analysis of Engineering Systems Fall 2014 Number: 15237 Instructor: Larry

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2016 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2016 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

Goals for This Lecture:

Goals for This Lecture: Goals for This Lecture: Understand the pass-by-value and passby-reference argument passing mechanisms of C++ Understand the use of C++ arrays Understand how arrays are passed to C++ functions Call-by-value

More information

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c Lecture 3 Data structures arrays structs C strings: array of chars Arrays as parameters to functions Multiple subscripted arrays Structs as parameters to functions Default arguments Inline functions Redirection

More information

Sample Questions Csci 1112 A. Bellaachia

Sample Questions Csci 1112 A. Bellaachia Sample Questions Csci 1112 A. Bellaachia Important Series : o S( N) 1 2 N N i N(1 N) / 2 i 1 o Sum of squares: N 2 N( N 1)(2N 1) N i for large N i 1 6 o Sum of exponents: N k 1 k N i for large N and k

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

In this Chapter you ll learn:

In this Chapter you ll learn: Now go, write it before them in a table, and note it in a book. Isaiah 30:8 To go beyond is as wrong as to fall short. Confucius Begin at the beginning, and go on till you come to the end: then stop. Lewis

More information

So far we have considered only numeric processing, i.e. processing of numeric data represented

So far we have considered only numeric processing, i.e. processing of numeric data represented Chapter 4 Processing Character Data So far we have considered only numeric processing, i.e. processing of numeric data represented as integer and oating point types. Humans also use computers to manipulate

More information

Basics of I/O Streams and File I/O

Basics of I/O Streams and File I/O Basics of This is like a cheat sheet for file I/O in C++. It summarizes the steps you must take to do basic I/O to and from files, with only a tiny bit of explanation. It is not a replacement for reading

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is preceded by an equal sign d. its name has undereline 2. Associations

More information

Lecture 5: Java Fundamentals III

Lecture 5: Java Fundamentals III Lecture 5: Java Fundamentals III School of Science and Technology The University of New England Trimester 2 2015 Lecture 5: Java Fundamentals III - Operators Reading: Finish reading Chapter 2 of the 2nd

More information

Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.

Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays. Arrays Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html 1 Grid in Assignment 2 How do you represent the state

More information

Introduction to Java. CS 3: Computer Programming in Java

Introduction to Java. CS 3: Computer Programming in Java Introduction to Java CS 3: Computer Programming in Java Objectives Begin with primitive data types Create a main class with helper methods Learn how to call built-in class methods and instance methods

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]

More information

Computer Science 2nd Year Solved Exercise. Programs 3/4/2013. Aumir Shabbir Pakistan School & College Muscat. Important. Chapter # 3.

Computer Science 2nd Year Solved Exercise. Programs 3/4/2013. Aumir Shabbir Pakistan School & College Muscat. Important. Chapter # 3. 2013 Computer Science 2nd Year Solved Exercise Chapter # 3 Programs Chapter # 4 Chapter # 5 Chapter # 6 Chapter # 7 Important Work Sheets Aumir Shabbir Pakistan School & College Muscat 3/4/2013 Chap #

More information

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example Announcements Memory management Assignment 2 posted, due Friday Do two of the three problems Assignment 1 graded see grades on CMS Lecture 7 CS 113 Spring 2008 2 Safe user input If you use scanf(), include

More information

Chapter 7: Additional Topics

Chapter 7: Additional Topics Chapter 7: Additional Topics In this chapter we ll briefly cover selected advanced topics in fortran programming. All the topics come in handy to add extra functionality to programs, but the feature you

More information

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

More information

COMPUTER SCIENCE. Paper 1 (THEORY)

COMPUTER SCIENCE. Paper 1 (THEORY) COMPUTER SCIENCE Paper 1 (THEORY) (Three hours) Maximum Marks: 70 (Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time) -----------------------------------------------------------------------------------------------------------------------

More information

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM. Course Title: Advanced Computer Programming (Code: 3320702)

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM. Course Title: Advanced Computer Programming (Code: 3320702) GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM Course Title: Advanced Computer Programming (Code: 3320702) Diploma Programmes in which this course is offered Computer Engineering,

More information

Choosing a Cell Phone Plan-Verizon

Choosing a Cell Phone Plan-Verizon Choosing a Cell Phone Plan-Verizon Investigating Linear Equations I n 2008, Verizon offered the following cell phone plans to consumers. (Source: www.verizon.com) Verizon: Nationwide Basic Monthly Anytime

More information

Managing Users and Identity Stores

Managing Users and Identity Stores CHAPTER 8 Overview ACS manages your network devices and other ACS clients by using the ACS network resource repositories and identity stores. When a host connects to the network through ACS requesting

More information

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE PROGRAMMING IN C CONTENT AT A GLANCE 1 MODULE 1 Unit 1 : Basics of Programming Unit 2 : Fundamentals Unit 3 : C Operators MODULE 2 unit 1 : Input Output Statements unit 2 : Control Structures unit 3 :

More information

Pseudo code Tutorial and Exercises Teacher s Version

Pseudo code Tutorial and Exercises Teacher s Version Pseudo code Tutorial and Exercises Teacher s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in 1.45. The aim is to get the idea quickly and also easy

More information

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following: In creating objects of the type, we have used statements similar to the following: f = new (); The parentheses in the expression () makes it look like a method, yet we never created such a method in our

More information

1 Abstract Data Types Information Hiding

1 Abstract Data Types Information Hiding 1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content

More information

C Examples! Jennifer Rexford!

C Examples! Jennifer Rexford! C Examples! Jennifer Rexford! 1 Goals of this Lecture! Help you learn about:! The fundamentals of C! Deterministic finite state automata (DFA)! Expectations for programming assignments! Why?! The fundamentals

More information

Arrays in Java. Working with Arrays

Arrays in Java. Working with Arrays Arrays in Java So far we have talked about variables as a storage location for a single value of a particular data type. We can also define a variable in such a way that it can store multiple values. Such

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

Introduction to Python

Introduction to Python WEEK ONE Introduction to Python Python is such a simple language to learn that we can throw away the manual and start with an example. Traditionally, the first program to write in any programming language

More information

8.1. Example: Visualizing Data

8.1. Example: Visualizing Data Chapter 8. Arrays and Files In the preceding chapters, we have used variables to store single values of a given type. It is sometimes convenient to store multiple values of a given type in a single collection

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

Chapter 13 Storage classes

Chapter 13 Storage classes Chapter 13 Storage classes 1. Storage classes 2. Storage Class auto 3. Storage Class extern 4. Storage Class static 5. Storage Class register 6. Global and Local Variables 7. Nested Blocks with the Same

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint) TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions

More information

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction IS0020 Program Design and Software Tools Midterm, Feb 24, 2004 Name: Instruction There are two parts in this test. The first part contains 50 questions worth 80 points. The second part constitutes 20 points

More information

The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 01 Test #4 November 20, 2002. True or False (2 points each)

The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 01 Test #4 November 20, 2002. True or False (2 points each) True or False (2 points each) The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 01 Test #4 November 20, 2002 1. Using global variables is better style than using local

More information

One Dimension Array: Declaring a fixed-array, if array-name is the name of an array

One Dimension Array: Declaring a fixed-array, if array-name is the name of an array Arrays in Visual Basic 6 An array is a collection of simple variables of the same type to which the computer can efficiently assign a list of values. Array variables have the same kinds of names as simple

More information

C PROGRAMMING FOR MATHEMATICAL COMPUTING

C PROGRAMMING FOR MATHEMATICAL COMPUTING UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION BSc MATHEMATICS (2011 Admission Onwards) VI Semester Elective Course C PROGRAMMING FOR MATHEMATICAL COMPUTING QUESTION BANK Multiple Choice Questions

More information

Conditionals (with solutions)

Conditionals (with solutions) Conditionals (with solutions) For exercises 1 to 27, indicate the output that will be produced. Assume the following declarations: final int MAX = 25, LIMIT = 100; int num1 = 12, num2 = 25, num3 = 87;

More information

Chapter 5 Programming Statements. Chapter Table of Contents

Chapter 5 Programming Statements. Chapter Table of Contents Chapter 5 Programming Statements Chapter Table of Contents OVERVIEW... 57 IF-THEN/ELSE STATEMENTS... 57 DO GROUPS... 58 IterativeExecution... 59 JUMPING... 61 MODULES... 62 Defining and Executing a Module....

More information

Java Basics: Data Types, Variables, and Loops

Java Basics: Data Types, Variables, and Loops Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Illustration 1: Diagram of program function and data flow

Illustration 1: Diagram of program function and data flow The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline

More information

Chapter 5 Names, Bindings, Type Checking, and Scopes

Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named

More information

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information