1. Write a program to calculate distance traveled by light
|
|
- Berenice Ross
- 5 years ago
- Views:
Transcription
1 G. H. R a i s o n i C o l l e g e O f E n g i n e e r i n g D i g d o h H i l l s, H i n g n a R o a d, N a g p u r D e p a r t m e n t O f C o m p u t e r S c i e n c e & E n g g P r a c t i c a l M a n n u a l S u b j e c t : - I n t r o. T o O b j e c t o r i e n t e d m e t h o d o l o g i e s S e m e s t e r : - f o u r t h S e m C S E
2 L i s t o f P r a c t i c a l s F o u r t h S e m C o m p u t e r S c i e n c e & E n g g S u b j e c t : I n t r o. T o o b j e c t o r i e n t e d m e t h o d o l o g i e s 1. Write a program to calculate distance traveled by light 2. W r i t e a p r o g r a m d e m o n s t r a t i n g B o o l e a n d a t a t y p e s 3. W A P t o d e m o n s t r a t e u s i n g c o m m a n d l i n e a r g u m e n t s 4. W A P t o e x p l a i n c o n c e p t o f s i m p l e i n h e r i t a n c e 5. W r i t e a r e c u r s i v e p r o g r a m t o c a l c u l a t e f a c t o r i a l o f n u m b e r 6. W r i t e a f u n c t i o n t o c o n c a t e n a t e t w o s t r i n g 7. W r i t e a m e n u d r i v e n p r o g r a m t o a d d m u l t i p l y d i v i d e a n d s u b t r a c t t w o m a t r i c e s 8. W r i t e a p r o g r a m t o u p d a t e e x i s t i n g f i l e E x p e r i m e n t N o : - 0 1
3 A I M : - : Write a program to calculate distance traveled by light T h e o r y : - Java supports basic 4 data types i.e integer, floating point number, character, Boolean There are four integer types defined in JAVA long, int, short, byte. The width of an integer type should not be thought of as the amount of storage it consumes but rather as the behavior it defines for variables and expressions of that type. Width and range of of variables are as below Name Width Range Long 64-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Int 32-2,147,483,648 to 2,147,483,647 Short 16-32,768 to 32,767 Byte to 127 There are two types of floating point data type Name Width in Bits Range Double e-308 to 1.7e+308 Float e-038 to 3.4e+038 A L G O R I T H M : - S t e p 1 D e c l a r e c l a s s l i g h t h a v i n g m e m b e r d a y s, l i g h t s p e e d, s e c o n d, d i s t a n c e S t e p 2 i n i t i a l i z e l i g h t s p e e d, d a y s S t e p 3 c o m p u t e s e c o n d s = d a y s * 2 4 * 6 0 * 6 0 S t e p 4 d i s t a n c e = l i g h t s p e e d * s e c o n d s S t e p 5 d i s p l a y d i s t a n c e S t e p 7 - E N D S A M P L E I N P U T / O U T P U T : I n d a y s l i g h t w i l l t r a v e l a b o u t m i l e s V I V A Q U E S T I O N S : 1 ) W h a t a r e d i f f e r e n t d a t a t y p e s a v a i l a b l e i n j a v a 2 ) H o w t h e n e e d o f u n s i g n e d v a r i a b l e i s a v o i d e d i n j a v a 3 ) W h a t a r e r a n g e o f d i f f e r e n t d a t a t y p e s a v a i l a b l e i n j a v a E x p e r i m e n t N o : - 0 2
4 A I M : - W r i t e a p r o g r a m d e m o n s t r a t i n g B o o l e a n d a t a t y p e s T H E O R Y : - J a v a h a s a s i m p l e t y p e c a l l e d B o o l e a n f o r l o g i c a l v a l u e s. I t c a n h a v e o n l y t w o p o s s i b l e v a l u e s, t r u e a n d f a l s e. T h i s i s t h e t y p e r e t u r n e d b y a l l r e l a t i o n a l o p e r a t o r s u c h a s a < b. B o o l e a n i s a l s o t y p e r e q u i r e d b y t h e c o n d i t i o n a l s t a t e m e n t t h a t g o v e r n s t h e c o n t r o l s t a t e m e n t s u c h a s i f a n d f o r. A L G O R I T H M : - 1 ) D e l a r e c l a s s B o o l T e s t w i t h m e m b e r v a r i a b l e b o f t y p e B o o l e a n 2 ) A s s i g n b = f a l s e 3 ) D i s p l a y b 4 ) A s s i g n b = t r u e 5 ) D i s p l a y b 6 ) I f b d i s p l a y T h i s i s n o t e x e c u t e d 7 ) E n d S A M P L E O U T P U T : b i s f a l s e b i s t r u e T h i s i s e x e c u t e d V I V A Q U E S T I O N : 1 ) W h a t i s B o o l e a n d a t a t y p e 2 ) H o w B o o l e a n v a r i a b l e i s u s e d i n c o n d i t i o n a l e x p r e s s i o n.
5 E x p e r i m e n t N o : A I M : - W A P t o d e m o n s t r a t e u s i n g c o m m a n d l i n e a r g u m e n t s T H E O R Y : - S o m e t i m e s y o u w i l l w a n t t o p a s s i n f o r m a t i o n i n t o a p r o g r a m w h e n y o u r u n i t. T h i s i s a c c o m p l i s h e d b y p a s s i n g c o m m a n d l i n e a r g u m e n t t o m a i n ( ). A c o m m a n d l i n e a r g u m e n t i s t h e i n f o r m a t i o n t h a t d i r e c t l y f o l l o w s t h e p r o g r a m s n a m e o n t h e c o m m a n d l i n e w h e n i t i s e x e c u t e d. T o a c e s s t h e c o m m a n d l i n e a r g u m e n t s i n j a v a p r o g r a m i s q u i t e e a s y, t h e y a r e s t o r e d a s s t r i n g s i n t h e S t r i n g a r r a y p a s s e d t o m a i n ( ). A L G O R I T H M : - 1 ) D e f i n e c l a s s C o m m a n d - l i n e 2 ) i = 0 3 ) I f i > = l e n g t h o f a r g u m e n t g o t o 7 4 ) D i s p l a y a r g s [ i ] 5 ) i = i ) G o t o 3 7 ) E n d I N P U T : J a v a C o m m a n d L i n e t h i s i s a t e s t O U T P U T : a r g s [ 0 ] : t h i s a r g s [ 1 ] : i s a r g s [ 2 ] : a a r g s [ 3 ] : t e s t a r g s [ 4 ] : a r g s [ 5 ] : - 1 V I V A Q U E S T I O N : 1 ) W h a t i s c o m m a n d l i n e a r g u m e n t 2 ) H o w c o m m a n d l i n e a r g u m e n t s a r e p a s s e d a n d c o l l e c t e d i n j a v a
6 E x p e r i m e n t N o : A I M : W A P t o e x p l a i n c o n c e p t o f s i m p l e i n h e r i t a n c e T H E O R Y : I n h e r i t a n c e i s o n e o f t h e c o r n e r s t o n e s o f o b j e c t o r i e n t e d p r o g r a m m i n g b e c a u s e i t a l l o w s t h e c r e a t i o n o f h i e r a r c h i c a l c l a s s i f i c a t i o n s. U s i n g i n h e r i t a n c e y o u c a n c r e a t e g e n e r a l c l a s s t h a t d e f i n e s t r a i t s c o m m o n t o a s e t o f r e l a t e d i t e m s. T h i s c l a s s c a n b e i n h e r i t e d b y o t h e r m o r e s p e c i f i c c l a s s e s e a c h a d d i n g t h o s e t h i n g s t h a t a r e u n i q u e t o i t. I n t h e t e r m i n o l o g y o f j a v a a c l a s s t h a t i s i n h e r i t e d i s c a l l e d s u p e r l a s s. T h e c l a s s t h a t d o e s t h e i n h e r i t i n g i s c a l l e d s u b c l a s s. T o i n h e r i t a c l a s s s i m p l y i n c o r p o r a t e t h e d e f i n i t i o n o f o n e c l a s s i n t o a n o t h e r u s i n g t h e e x t e n d k e y w o r d. 1 ) C r e a t e c l a s s A 2 ) D e c l a r e i n t e g e r m e m b e r i, j 3 ) D e c l a r e f u n c t i o n s h o w i j ( ) w i t h i n c l a s s A 4 ) j = j ) g o t o ) i f a [ i ] = = a [ i ] g o t o ) c [ k ] = a [ i ] 8 ) k = k ) i = i ) g o t o ) c [ k ] = a [ i ] 1 2 ) i = i ) j = j ) k = k ) g o t o ) e n d I N P U T / O U T P U T : R e a d e l e m e n t o f a r r a a : 5 R e a d a r r a y s o r t e d a r r a y a : R e a d s o r t e d a r r a y b : 1 5 R e a d e l m e n t o f a r r a y b : R e s u l t a n t A r r a y C 3
7
8 E x p e r i m e n t N o : A I M : W r i t e a r e c u r s i v e p r o g r a m t o c a l c u l a t e f a c t o r i a l o f n u m b e r T h e o r y : R e c u r s i o n i s a p r o c e s s w h e r e a s u b r o u t i n e o r f u n c t i o n c a l l s i t s e l f a g a i n a n d a g a i n w i t h d i f f e r e n t a r g u m e n t v a l u e. W h e n e v e r t h e r e i n a f u n c t i o n c a l l s t a t u s o f c p u r e g i s t e r i s s a v e d o n s t a c k a n d w h e n f u n c t i o n g e t s c o m p l e t e d a n d r e t u r n s t a t e m e n t e x e c u t e s s t a t u s o f c p u e n v i r o n m e n t g e t r e c o v e r e d f r o m s t a c k. T h u s t i l l t h e s t a c k i s e m p t y r e c u r s i o n c a n o c c u r b u t a s s o o n a s s t a c k o v e r f l o w s n o m o r e r e c u r s i o n i s p o s s i b l e. S t o p p i n g c o n d i t i o n i s n e c e s s a r y i n r e c u r s i o n o t h e r w i s e a l o t o f m e m o r y m a y b e w a s t e d. f a c t o r i a l o f a n u m b e r n i s n * ( n - 1 ) * ( n - 2 ) * ( n - 3 ) 1 A L G O R I T H M : M a i n ( ) 1 ) R e a d n 2 ) f = f a c t ( n ) 3 ) P r i n t f 4 ) E n d i n t f a c t ( n ) 1 ) I f n = = 1 t h e n f = 1 e l s e f = n * f a c t ( n - 1 ) 2 ) R e t u r n f S a m p l e I n p u t / O u t p u t : E n t e r n u m b e r : 4 F a c t o r i a l o f 4 : 2 4 V I V A Q U E S T I O N : 1 ) W h a t i s r e c u r s i o n 2 ) W h a t i s d i f f e r e n c e b e t w e e n r e c u r s i o n a n d i t e r a t i o n 3 ) I F t h e r e i s n o s t o p p i n g c o n d i t i o n i n r e c u r s i o n h o w m a n y t i m e s r e c u r s i o n w i l l o c c u r
9 E x p e r i m e n t N o : A I M : W r i t e a f u n c t i o n t o c o n c a t e n a t e t w o s t r i n g T H O R Y : s t r i n g s a r e n o t h i n g b u t c h a r a c t e r a r r a y. e n d o f s t r i n g s i s i n d i c a t e d b y c h a r a c t e r \ 0. w h e n e v e r s c a n f s t a t e m e n t i s u s e d f o r f o r s c a n n i n g s t r i n g a n d % s n o t a t i o n i s u s e d f o r s c a n n i n g a u t o m a t i c a l l y c h a r a c t e r \ 0 i s a p p e n d e d i n s t r i n g b u t t h i s c h a r a c t e r i s n o t c o u n t e d i n l e n g t h o f s t r i n g. t o c o n c a t e n a t e t w o s t r i n g f i r s t i t i s n e c e s s a r y t o k n o w t h e l e n g t h o f s t r i n g f o r t h i s s t r l e n ( a, b ) f u n c t i o n c a n b e u s e d. I t r e t u r n s l e n g t h o f s t r i n g i n i n t e g e r. A l l s t r i n g f u n c t i o n s a r e d e f i n e d i n h e a d e r f i l e s t r i n g. h. A L G O R I T H M : 1 ) r e a d s t r i n g a 2 ) r e a d s t r i n g b 3 ) s s t r c a t ( a, b ) 4 ) p r i n t s t r i n g a 5 ) e n d s s t r c a t ( c h a r * a, c h a r * b ) 1 ) m = l e n g t h ( a ) 2 ) n = l e n ( b ) 3 ) i = 0 4 ) i f i > = n g o t o 8 5 ) a [ m + i ] = b [ i ] 6 ) i = i ) g o t o 4 8 ) r e t u r n I N P U T / O U T P U T R e a d s t r i n g a : a b c R e a d s t r i n g b : e r f g O u t p u t S t r i n g a : a b c e r f g V I V A Q U E S T I O N : 1 ) w h a t a r e d i f f e r e n t f u n c t i o n d e f i n e d i n h e a d e r f i l e s t r i n g. h 2 ) w h a t d o y o u m e a n b y h e a d e r f i l e s 3 ) w h a t i s p r e p r o c e s s o r 4 ) w h a t i s c o n i o. h a n d s t r i n g. h
10 E x p e r i m e n t N o : A i m : W r i t e a m e n u d r i v e n p r o g r a m t o a d d m u l t i p l y d i v i d e a n d s u b t r a c t t w o m a t r i c e s T h e o r y : I n m e n u d r i v e n p r o g r a m s w i t c h s t a t e m e n t i s u s e d t o p e r f o r m d i f f e r e n t o p e r a t i o n o n s a m e d a t a. T o r e p e a t t h e o p e r a t i o n s w i t c h s t a t e m e n t i s g e n e r a l l y e n c l o s e d i n w h i l e l o o p. A s u s e r e n t e r s c h o i c e 0 p r o g r a m t e r m i n a t e s w i t h r e t u r n s t a t e m e n t f r o m m a i n. E v e r y m a t r i x o p e r a t i o n c o n s i s t o f r e a d i n g a n d d i s p l a y o p e r a t i o n s o i t i s b e t t e r t o d e f i n e f u n c t i o n f o r r e a d i n g a n d p r i n t i n g o p e r a t i o n o f m a t r i x. d i m e n s i o n o f m a t r i x c a n b e p a s s e d t o f u n c t i o n a s a r g u m e n t o r i t c a n b e d e f i n e d a s g l o b a l v a r i a b l e s o t h a t t h e r e w i l l n o t b e a n y n e e d t o p a s s t h e a r g u m e n t. A l g o r i t h m : 1 ) D i s p l a y m e n u f o r o p t i o n s 2 ) r e a d d i m e n s i o n f o r f i r s t m a t r i x m, n 3 ) R e a d f i r s t m a t r i x r e a d m ( a, m, n ) 4 ) R e a d d i m e n s i o n f o r s e c o n d m a t r i x p, q 5 ) R e a d s e c o n d m a t r i x r e a d m ( b, p, q ) 6 ) R e a d c h o i c e c h 7 ) i f c h = = 1 c a l l f u n c t i o n a d d ( c, a, b ) 8 ) c a l l f u n c t i o n d i s p l a y ( c, m, n ) 9 ) g o t o ) i f c h = = 2 c a l l f u n c t i o n s u b ( c, a, b ) 1 1 ) c a l l f u n c t i o n d i s p l a y ( c, m, n ) 1 2 ) g o t o ) i f c h = = 3 c a l l f u n c t i o n m u l ( c, a, b ) 1 4 ) c a l l f u n c t i o n d i s p l a y ( c, m, q ) 1 5 ) g o t o ) i f c h = = 0 g o t o ) E n d V I V A Q U E S T I O N : 1 ) W h a t i s p a s s b y v a l u e a n d p a s s b y r e f e r e n c e 2 ) W h a t i s l o c a l a n d g l o b a l v a r i a b l e 3 ) W h a t i s s c o p e o f v a r i a b l e 4 ) H o w t o d e c l a r e f u n c t i o n w h i c h d o n t r e t u r n a n y t h i n g t o c a l l i n g f u n c t i o n
11 E x p e r i m e n t N o : A I M : W r i t e a p r o g r a m t o u p d a t e e x i s t i n g f i l e T H E O R Y : t h e r e a r e d i f f e r e n t m o d e s f o r o p e n i n g f i l e s l i k e r e a d m o d e w r i t e m o d e a p p e n d m o d e, R e a d w r i t e m o d e. F o p e n s t a t e m e n t i s u s e d t o o p e n t h e f i l e. S y n t a x o f f o p e n i s f p = f o p e n ( f i l e n a m e, m o d e ) w h e r e f p i s f i l e p o i n t e r a n d f i l e n a m e i s n a m e o f t h e f i l e w h i c h y o u w a n t t o o p e n a n d m o d e i s t h e m o d e i n w h i c h o n e w a n t s t o o p e n t h e f i l e. f u n c t i o n f s e e k c a n b e u s e d t o a d v a n c e f i l e p o i n t e r t o d e s i r e d l o c a t i o n. f u n c t i o n f t e l l t e l l s t h e l o c a t i o n o f f i l e p o i n t e r i n b y t e s. f u n c t i o n f r e w i n d i s u s e d t o r e w i n d t h e f i l e p o i n t e r a t t h e b e g i n n i n g A l g o r i t h m : 1 ) d e f i n e s t r u c t u r e o f r e c o r d c o n s i s t i n g o f r o l l n o, n a m e m a r k s 2 ) o p e n a f i l e d a t a i n. d a t i n i n p u t m o d e ( r ) 3 ) r e a d i n f o r m a t i o n f r o m s t u d e n t a n d p r i n t i t o n f i l e s f o r e a c h r e c o r d 4 ) c l o s e f i l e 5 ) o p e n a f i l e d a t a i n. d a t i n r e a d w r i t e m o d e ( w + ) 6 ) r e a d i n f o r m a t i o n o f r e r o r d w h i c h y o u w a n t t o u p d a t e 7 ) s e a r c h r e c o r d s i n f i l e b y s e q u e n t i a l s e a r c h t i l l e n d o f f i l e 8 ) i f r e c o r d i s f o u n d g e t n e w v a l u e f r o m u s e r a n d d i s p l a y i t o n f i l e 9 ) c l o s e f i l e d a t a i n. d a t 1 0 ) e n d I N P U T / O U T P U T E n t e r n a m e : a b c E n t e r r o l l n o : 1 4 E n t e r m a r k s : E n t e r n a m e : a b c O n e r e c o r d f o u n d i n f o r m a t i o n i s a s b e l o w N a m e : a b c R o l l n o : 1 4 M a r k s : E n t e r n e w i n f o r m a t i o n E n t e r n a m e : a b c E n t e r r o l l n o : 1 4 E n t e r m a r k s : 9 0 O n e r e c o r d i s u p d a t e d V I V A Q U E S T I O N : 1 ) w h a t i s s y n t a x o f f o p e n
12 2 ) h o w o n e c a n k n o w l o c a t i o n o f f i l e p o i n t e r 3 ) h o w t o a d v a n c e f i l e p o i n t e r 4 ) w h a t i s b i n a r y m o d e o f f i l e 5 ) h o w o n e c a n k n o w w h e t h e r e n d o f f i l e i s r e a c h e d o r n o t
Number Representation and Waveform Quantization
1 Number Representation and Waveform Quantization 1 Introduction This lab presents two important concepts for working with digital signals. The first section discusses how numbers are stored in memory.
More informationCSE 1400 Applied Discrete Mathematics Definitions
CSE 1400 Applied Discrete Mathematics Definitions Department of Computer Sciences College of Engineering Florida Tech Fall 2011 Arithmetic 1 Alphabets, Strings, Languages, & Words 2 Number Systems 3 Machine
More informationn CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161
Discrete Math at CSU (Rosen book) Sets and Functions (Rosen, Sections 2.1,2.2, 2.3) TOPICS Discrete math Set Definition Set Operations Tuples 1 n CS 160 or CS122 n Sets and Functions n Propositions and
More informationCS Exam 1 Study Guide and Practice Exam
CS 150 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Suggestions, Warnings, and Resources.................................
More informationComputer Science Introductory Course MSc - Introduction to Java
Computer Science Introductory Course MSc - Introduction to Java Lecture 1: Diving into java Pablo Oliveira ENST Outline 1 Introduction 2 Primitive types 3 Operators 4 5 Control Flow
More informationTake-home Lab 1. Arrays
Take-home Lab 1 Arrays Findx 2-Dimensional Array Graded! Submit by Friday 23:59 Find You are given a treasure map by your friend Map is divided into R by C cells Super Marks The Spot You need to find all
More informationOutline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014
Outline 1 midterm exam on Friday 11 July 2014 policies for the first part 2 questions with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014 Intro
More informationLecture 4 Modeling, Analysis and Simulation in Logic Design. Dr. Yinong Chen
Lecture 4 Modeling, Analysis and Simulation in Logic Design Dr. Yinong Chen The Engineering Design Process Define Problem and requirement Research Define Alternative solutions CAD Modeling Analysis Simulation
More informationChapter 4 Number Representations
Chapter 4 Number Representations SKEE2263 Digital Systems Mun im/ismahani/izam {munim@utm.my,e-izam@utm.my,ismahani@fke.utm.my} February 9, 2016 Table of Contents 1 Fundamentals 2 Signed Numbers 3 Fixed-Point
More informationData byte 0 Data byte 1 Data byte 2 Data byte 3 Data byte 4. 0xA Register Address MSB data byte Data byte Data byte LSB data byte
SFP200 CAN 2.0B Protocol Implementation Communications Features CAN 2.0b extended frame format 500 kbit/s Polling mechanism allows host to determine the rate of incoming data Registers The SFP200 provides
More informationE40M. Binary Numbers. M. Horowitz, J. Plummer, R. Howe 1
E40M Binary Numbers M. Horowitz, J. Plummer, R. Howe 1 Reading Chapter 5 in the reader A&L 5.6 M. Horowitz, J. Plummer, R. Howe 2 Useless Box Lab Project #2 Adding a computer to the Useless Box alows us
More informationLisp Introduction. Dr. Neil T. Dantam. Spring CSCI-498/598 RPM, Colorado School of Mines. Dantam (Mines CSCI, RPM) Lisp Spring / 88
Lisp Introduction Dr. Neil T. Dantam CSCI-498/598 RPM, Colorado School of Mines Spring 28 Dantam (Mines CSCI, RPM) Lisp Spring 28 / 88 Outline Lisp Common Lisp by Example Implementation Details Typing
More informationIntroduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Rimon Elias Dr. Hisham Othman Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
More informationIntroduction to Programming (Java) 3/12
Introduction to Programming (Java) 3/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction
More informationDepartment of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)
Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Problem 1: Specify two different predicates P (x) and
More informationDigital Electronics Part 1: Binary Logic
Digital Electronics Part 1: Binary Logic Electronic devices in your everyday life What makes these products examples of electronic devices? What are some things they have in common? 2 How do electronics
More informationSUPPLEMENTARY INFORMATION
SUPPLEMENTARY INFORMATION doi:10.1038/nature11875 Method for Encoding and Decoding Arbitrary Computer Files in DNA Fragments 1 Encoding 1.1: An arbitrary computer file is represented as a string S 0 of
More informationChapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)
CSE 54 Discrete Mathematics & Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices Integers & Algorithms (Section 2.5) by Kenneth H. Rosen, Discrete Mathematics & its Applications,
More informationIntroduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
More informationMathematical Fundamentals
Mathematical Fundamentals Sets Factorials, Logarithms Recursion Summations, Recurrences Proof Techniques: By Contradiction, Induction Estimation Techniques Data Structures 1 Mathematical Fundamentals Sets
More informationITI Introduction to Computing II
(with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 11, 2015 Please don t print these lecture notes unless you really need to!
More informationComputer Arithmetic. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Computer Arithmetic
Computer Arithmetic MATH 375 Numerical Analysis J. Robert Buchanan Department of Mathematics Fall 2013 Machine Numbers When performing arithmetic on a computer (laptop, desktop, mainframe, cell phone,
More informationmith College Computer Science CSC231 - Assembly Week #7 Dominique Thiébaut
mith College Computer Science CSC231 - Assembly Week #7 Dominique Thiébaut dthiebaut@smith.edu public class JavaLimits { public static void main(string[] args) { // -----------------------------------------------
More informationHow do computers represent numbers?
How do computers represent numbers? Tips & Tricks Week 1 Topics in Scientific Computing QMUL Semester A 2017/18 1/10 What does digital mean? The term DIGITAL refers to any device that operates on discrete
More informationCSE 311: Foundations of Computing. Lecture 10: Set Operations & Representation, Modular Arithmetic
CSE 311: Foundations of Computing Lecture 10: Set Operations & Representation, Modular Arithmetic Definitions A and B are equal if they have the same elements A = B x (x A x B) A is a subset of B if every
More informationToday s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions
Today s Topics Set identities Methods of proof Relationships to logical equivalences Functions Important definitions Relationships to sets, relations Special functions Set identities help us manipulate
More informationCS 163/164 - Exam 1 Study Guide and Practice Exam
CS 163/164 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Strings...................................................
More informationMultiple-Site Distributed Spatial Query Optimization using Spatial Semijoins
11 Multiple-Site Distributed Spatial Query Optimization using Spatial Semijoins Wendy OSBORN a, 1 and Saad ZAAMOUT a a Department of Mathematics and Computer Science, University of Lethbridge, Lethbridge,
More informationITI Introduction to Computing II
(with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 9, 2019 Please don t print these lecture notes unless you really need to!
More informationCS3110 Fall 2013 Lecture 11: The Computable Real Numbers, R (10/3)
CS3110 Fall 2013 Lecture 11: The Computable Real Numbers, R (10/3) Robert Constable 1 Lecture Plan More about the rationals dependent types enumerating Q (Q is countable) Function inverses bijections one-one
More informationDigital Systems and Information Part II
Digital Systems and Information Part II Overview Arithmetic Operations General Remarks Unsigned and Signed Binary Operations Number representation using Decimal Codes BCD code and Seven-Segment Code Text
More informationECE 372 Microcontroller Design
Data Formats Humor There are 10 types of people in the world: Those who get binary and those who don t. 1 Information vs. Data Information An abstract description of facts, processes or perceptions How
More informationThe max flow problem. Ford-Fulkerson method. A cut. Lemma Corollary Max Flow Min Cut Theorem. Max Flow Min Cut Theorem
The max flow problem Ford-Fulkerson method 7 11 Ford-Fulkerson(G) f = 0 while( simple path p from s to t in G f ) 10-2 2 1 f := f + f p output f 4 9 1 2 A cut Lemma 26. + Corollary 26.6 Let f be a flow
More informationPolynomial Selection. Thorsten Kleinjung École Polytechnique Fédérale de Lausanne
Polynomial Selection Thorsten Kleinjung École Polytechnique Fédérale de Lausanne Contents Brief summary of polynomial selection (no root sieve) Motivation (lattice sieving, monic algebraic polynomial)
More informationFACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING OBJECT ORIENTED PROGRAMMING DATE 07/2014 SESSION 8:00-10:00
FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING MODULE CAMPUS CSC2A10 OBJECT ORIENTED PROGRAMMING AUCKLAND PARK CAMPUS (APK) EXAM JULY 2014 DATE 07/2014 SESSION 8:00-10:00 ASSESOR(S)
More informationMany algorithms do not fall into this class. Example: The travelling salesperson problem (TSP).
Exponential Complexity Algorithms that have a complexity of O(n p ) (where n is a measure of the problem size) are said to have polynomial complexity. They are considered reasonably efficient, specially
More informationChapter 1 Error Analysis
Chapter 1 Error Analysis Several sources of errors are important for numerical data processing: Experimental uncertainty: Input data from an experiment have a limited precision. Instead of the vector of
More informationDynamic Programming Part 2: Probability, Combinatorics, and Bitmasks
Dynamic Programming Part 2: Probability, Combinatorics, and Bitmasks Duke Compsci 309s Siyang Chen Introduction Probability, combinatorics, and bitmasking appear commonly in dynamic programming problems.
More information12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System?
Digital Operations and Computations Course Notes 0-Number Systems Text: Unit Winter 20 Professor H. Louie Department of Electrical & Computer Engineering Seattle University ECEGR/ISSC 20 Digital Operations
More informationDigital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1
Digital Systems Digital systems have such a prominent role in everyday life The digital age The technology around us is ubiquitous, that is we don t even notice it anymore Digital systems are used in:
More informationCMPSCI611: Three Divide-and-Conquer Examples Lecture 2
CMPSCI611: Three Divide-and-Conquer Examples Lecture 2 Last lecture we presented and analyzed Mergesort, a simple divide-and-conquer algorithm. We then stated and proved the Master Theorem, which gives
More informationCSE 311: Foundations of Computing. Lecture 10: Set Operations & Representation, Modular Arithmetic
CSE 311: Foundations of Computing Lecture 10: Set Operations & Representation, Modular Arithmetic Definitions A and B are equalif they have the same elements A = B x(x A x B) A is a subsetof B if every
More informationLecture 5: Sep. 23 &25
CIS 2168 Data Structures Fall 2014 Lecturer: Anwar Mamat Lecture 5: Sep. 23 &25 Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 5.1 Doubly Linked
More informationError Detection and Correction: Small Applications of Exclusive-Or
Error Detection and Correction: Small Applications of Exclusive-Or Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin Exclusive-Or (XOR,
More informationFrom Fourier Series to Analysis of Non-stationary Signals - II
From Fourier Series to Analysis of Non-stationary Signals - II prof. Miroslav Vlcek October 10, 2017 Contents Signals 1 Signals 2 3 4 Contents Signals 1 Signals 2 3 4 Contents Signals 1 Signals 2 3 4 Contents
More informationCMPE12 - Notes chapter 1. Digital Logic. (Textbook Chapter 3)
CMPE12 - Notes chapter 1 Digital Logic (Textbook Chapter 3) Transistor: Building Block of Computers Microprocessors contain TONS of transistors Intel Montecito (2005): 1.72 billion Intel Pentium 4 (2000):
More informationEAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science
EAD 115 Numerical Solution of Engineering and Scientific Problems David M. Rocke Department of Applied Science Computer Representation of Numbers Counting numbers (unsigned integers) are the numbers 0,
More informationQuerying. 1 o Semestre 2008/2009
Querying Departamento de Engenharia Informática Instituto Superior Técnico 1 o Semestre 2008/2009 Outline 1 2 3 4 5 Outline 1 2 3 4 5 function sim(d j, q) = 1 W d W q W d is the document norm W q is the
More informationIntroduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion: power(m,n) = m n
German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion:
More informationVocabulary of the trustful JVM I
Instructions: Instr = Prim(PrimOp) Load(MoveType, RegNo) Store(MoveType, RegNo) Dupx(Size, Size) Pop(Size) Goto(Offset) Cond(PrimOp, Offset) Halt Universes: Vocabulary of the trustful JVM I Offset = Nat
More informationFinite Automata Part Two
Finite Automata Part Two DFAs A DFA is a Deterministic Finite Automaton A DFA is defined relative to some alphabet Σ. For each state in the DFA, there must be exactly one transition defined for each symbol
More informationSection Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence
Section 2.4 1 Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations 2 Introduction Sequences are ordered lists of
More informationCS 7B - Spring Assignment: Adapting the calculator for bitwise expressions. due 2/21/18
CS 7B - Spring 2018 - Assignment: Adapting the calculator for bitwise expressions. due 2/21/18 Background Theory A bitwise number is a number in base 2. In base 2, place values are either a 1 or 0, depending
More informationECE260: Fundamentals of Computer Engineering
Data Representation & 2 s Complement James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Data
More informationENGIN 112 Intro to Electrical and Computer Engineering
ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems Overview Hexadecimal numbers Related to binary and octal numbers Conversion between hexadecimal, octal and binary Value
More informationQuasi Analog Formal Neuron and Its Learning Algorithm Hardware
Quasi Analog Formal Neuron and Its Learning Algorithm Hardware Karen Nazaryan Division of Microelectronics and Biomedical Devices, State Engineering University of Armenia, 375009, Terian Str. 105, Yerevan,
More informationMiniMat: Matrix Language in OCaml LLVM
Terence Lim - tl2735@columbia.edu August 17, 2016 Contents 1 Introduction 4 1.1 Goals........................................ 4 1.1.1 Flexible matrix notation......................... 4 1.1.2 Uncluttered................................
More informationR ij = 2. Using all of these facts together, you can solve problem number 9.
Help for Homework Problem #9 Let G(V,E) be any undirected graph We want to calculate the travel time across the graph. Think of each edge as one resistor of 1 Ohm. Say we have two nodes: i and j Let the
More informationComputer organization
Computer organization Levels of abstraction Assembler Simulator Applications C C++ Java High-level language SOFTWARE add lw ori Assembly language Goal 0000 0001 0000 1001 0101 Machine instructions/data
More informationHow many hours would you estimate that you spent on this assignment?
The first page of your homework submission must be a cover sheet answering the following questions. Do not leave it until the last minute; it s fine to fill out the cover sheet before you have completely
More informationA High Level Programming Language for Quantum Computing
QUARK QUantum Analysis and Realization Kit A High Level Programming Language for Quantum Computing Team In lexicographical order: Name UNI Role Daria Jung djj2115 Verification and Validation Jamis Johnson
More informationDigital Logic: Boolean Algebra and Gates. Textbook Chapter 3
Digital Logic: Boolean Algebra and Gates Textbook Chapter 3 Basic Logic Gates XOR CMPE12 Summer 2009 02-2 Truth Table The most basic representation of a logic function Lists the output for all possible
More informationFields in Cryptography. Çetin Kaya Koç Winter / 30
Fields in Cryptography http://koclab.org Çetin Kaya Koç Winter 2017 1 / 30 Field Axioms Fields in Cryptography A field F consists of a set S and two operations which we will call addition and multiplication,
More informationIntroduction to Digital Logic Missouri S&T University CPE 2210 Number Systems
Introduction to Digital Logic Missouri S&T University CPE 2210 Number Systems Egemen K. Çetinkaya Egemen K. Çetinkaya Department of Electrical & Computer Engineering Missouri University of Science and
More informationPaper UC1099 Implementing the SDSFIE Release 2.50 with Geodatabases
Implementing the SDSFIE Release 2.50 with Geodatabases 1 Presenter The CADD/GIS Technology Center https://tsc.wes.army.mil Nancy Towne (601) 634-3181 Nancy.A.Towne@erdc.usace.army.mil 2 Steps for Implementing
More informationMultiplying Products of Prime Powers
Problem 1: Multiplying Products of Prime Powers Each positive integer can be expressed (in a unique way, according to the Fundamental Theorem of Arithmetic) as a product of powers of the prime numbers.
More informationCs302 Quiz for MID TERM Exam Solved
Question # 1 of 10 ( Start time: 01:30:33 PM ) Total Marks: 1 Caveman used a number system that has distinct shapes: 4 5 6 7 Question # 2 of 10 ( Start time: 01:31:25 PM ) Total Marks: 1 TTL based devices
More informationSingular Value Decompsition
Singular Value Decompsition Massoud Malek One of the most useful results from linear algebra, is a matrix decomposition known as the singular value decomposition It has many useful applications in almost
More informationMeasuring Goodness of an Algorithm. Asymptotic Analysis of Algorithms. Measuring Efficiency of an Algorithm. Algorithm and Data Structure
Measuring Goodness of an Algorithm Asymptotic Analysis of Algorithms EECS2030 B: Advanced Object Oriented Programming Fall 2018 CHEN-WEI WANG 1. Correctness : Does the algorithm produce the expected output?
More informationChapter 1: Preliminaries and Error Analysis
Chapter 1: Error Analysis Peter W. White white@tarleton.edu Department of Tarleton State University Summer 2015 / Numerical Analysis Overview We All Remember Calculus Derivatives: limit definition, sum
More informationBig-O Notation and Complexity Analysis
Big-O Notation and Complexity Analysis Jonathan Backer backer@cs.ubc.ca Department of Computer Science University of British Columbia May 28, 2007 Problems Reading: CLRS: Growth of Functions 3 GT: Algorithm
More informationCS100: DISCRETE STRUCTURES
1 CS100: DISCRETE STRUCTURES Computer Science Department Lecture 2: Functions, Sequences, and Sums Ch2.3, Ch2.4 2.3 Function introduction : 2 v Function: task, subroutine, procedure, method, mapping, v
More informationLexical Analysis. Reinhard Wilhelm, Sebastian Hack, Mooly Sagiv Saarland University, Tel Aviv University.
Lexical Analysis Reinhard Wilhelm, Sebastian Hack, Mooly Sagiv Saarland University, Tel Aviv University http://compilers.cs.uni-saarland.de Compiler Construction Core Course 2017 Saarland University Today
More informationRecurrence Relations and Recursion: MATH 180
Recurrence Relations and Recursion: MATH 180 1: Recursively Defined Sequences Example 1: The sequence a 1,a 2,a 3,... can be defined recursively as follows: (1) For all integers k 2, a k = a k 1 + 1 (2)
More informationThe Ongoing Development of CSDP
The Ongoing Development of CSDP Brian Borchers Department of Mathematics New Mexico Tech Socorro, NM 87801 borchers@nmt.edu Joseph Young Department of Mathematics New Mexico Tech (Now at Rice University)
More informationCSE 311: Foundations of Computing. Lecture 10: Set Operations & Representation, Modular Arithmetic
CSE 311: Foundations of Computing Lecture 10: Set Operations & Representation, Modular Arithmetic Definitions A and B are equalif they have the same elements A = B x(x A x B) A is a subsetof B if every
More informationCHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1
CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY E. Amaldi Foundations of Operations Research Politecnico di Milano 1 Goal: Evaluate the computational requirements (this course s focus: time) to solve
More information2013/Fall-Winter Term Monday 12:50 Room# or 5F Meeting Room Instructor: Fire Tom Wada, Professor
SYSTEM ARCHITECTURE ADVANCED SYSTEM ARCHITECTURE Error Correction Code 1 01/Fall-Winter Term Monday 1:50 Room# 1- or 5F Meeting Room Instructor: Fire Tom Wada, Professor 014/1/0 System Arch 1 Introduction
More informationLoss of excitation protection function (40Z)
Loss of excitation protection function (40Z) Budapest, April 2016 Loss of excitation protection function The loss of excitation protection function can be applied mainly for synchronous generators. On
More informationIntroduction to Digital Logic Missouri S&T University CPE 2210 Number Systems
Introduction to Digital Logic Missouri S&T University CPE 2210 Number Systems Egemen K. Çetinkaya Egemen K. Çetinkaya Department of Electrical & Computer Engineering Missouri University of Science and
More informationECE/CS 552: Introduction To Computer Architecture 1. Instructor:Mikko H Lipasti. Fall 2010 University i of Wisconsin-Madison
ECE/CS 552: Arithmetic I Instructor:Mikko H Lipasti Fall 2010 Univsity i of Wisconsin-Madison i Lecture notes partially based on set created by Mark Hill. Basic Arithmetic and the ALU Numb representations:
More informationMotivation. Dictionaries. Direct Addressing. CSE 680 Prof. Roger Crawfis
Motivation Introduction to Algorithms Hash Tables CSE 680 Prof. Roger Crawfis Arrays provide an indirect way to access a set. Many times we need an association between two sets, or a set of keys and associated
More informationE&CE 223 Digital Circuits & Systems. Winter Lecture Transparencies (Introduction) M. Sachdev
E&CE 223 Digital Circuits & Systems Winter 2004 Lecture Transparencies (Introduction) M. Sachdev 1 of 38 Course Information: People Instructor M. Sachdev, CEIT 4015, ext. 3370, msachdev@uwaterloo.ca Lab
More informationRevisiting AES Related-Key Differential Attacks with Constraint Programming
Revisiting AES Related-Key Differential Attacs with Constraint Programming D Gerault (), P Lafourcade (), M Minier (2), C Solnon (3) () - LIMOS, Université Clermont-Ferrand (2) - LORIA, Université de Lorraine
More informationUNIVERSITI TENAGA NASIONAL. College of Information Technology
UNIVERSITI TENAGA NASIONAL College of Information Technology BACHELOR OF COMPUTER SCIENCE (HONS.) FINAL EXAMINATION SEMESTER 2 2012/2013 DIGITAL SYSTEMS DESIGN (CSNB163) January 2013 Time allowed: 3 hours
More information2 - Strings and Binomial Coefficients
November 14, 2017 2 - Strings and Binomial Coefficients William T. Trotter trotter@math.gatech.edu Basic Definition Let n be a positive integer and let [n] = {1, 2,, n}. A sequence of length n such as
More informationUnbounded Spigot Algorithms for π. Jeremy Gibbons IIJ, March 2017
Unbounded Spigot Algorithms for π Jeremy Gibbons IIJ, March 2017 Unbounded Spigot Algorithms for Pi 2 1. Spigot algorithms for π Rabinowitz & Wagon s algorithm, obfuscated by Winter & Flammenkamp: a[52514],
More informationAdvanced Information Storage 02
dvanced Information Storage 02 tsufumi Hirohata Department of Electronics 16:00 10/October/2013 Thursday (V 120) Quick Review over the Last Lecture Von Neumann s model : Memory access : Bit / byte : 1
More informationSection Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence
Section 2.4 Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations Introduction Sequences are ordered lists of elements.
More informationGoogle Go illustrated on the basis of Fibonacci numbers
Google Go illustrated on the basis of Fibonacci numbers Jan Pennekamp RWTH University Aachen Chair for Data Management and Data Exploration Prof. Dr. T. Seidl Supervision: Dipl.-Ing. Marwan Hassani Friday,
More informationLOGIC GATES. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.
Basic Eperiment and Design of Electronics LOGIC GATES Ho Kyung Kim, Ph.D. hokyung@pusan.ac.kr School of Mechanical Engineering Pusan National University Outline Boolean algebra Logic gates Karnaugh maps
More information1014/15 R Float Volt - - Voltage, L-L, ave of 3 phases 1016/17 R Float Volt - - Voltage, L-N, ave of 3 phases
PM700 MODBUS POINT MAP Scale 1000/01 R NV Float kwh - - Real Energy Consumption 1002/03 R NV Float kvah - - Apparent Energy Consumption 1004/05 R NV Float kvarh - - Reactive Energy Consumption 1006/07
More informationWelcome to PR3 The Art of Optimization. Lecture 3 May 22nd, IGAD - Hopmanstraat, Breda
Lecture 3 May 22nd, 2015 - IGAD - Hopmanstraat, Breda Lecture 3 May 22nd, 2015 - IGAD - Hopmanstraat, Breda > Recap > Demo Time > SIMD part 1/3 > Fixed Point part 2/2 > Homework part 3/4 > Coding Time
More informationCSE 311 Lecture 11: Modular Arithmetic. Emina Torlak and Kevin Zatloukal
CSE 311 Lecture 11: Modular Arithmetic Emina Torlak and Kevin Zatloukal 1 Topics Sets and set operations A quick wrap-up of Lecture 10. Modular arithmetic basics Arithmetic over a finite domain (a.k.a
More informationENGIN 112 Intro to Electrical and Computer Engineering
ENGIN 112 Intro to Electrical and Computer Engineering Lecture 2 Number Systems Russell Tessier KEB 309 G tessier@ecs.umass.edu Overview The design of computers It all starts with numbers Building circuits
More informationCS220/MATH320 Applied Discrete Math Fall 2018 Instructor: Marc Pomplun. Assignment #3. Sample Solutions
CS22/MATH2 Applied Discrete Math Fall 28 Instructor: Marc Pomplun Assignment # Sample Solutions Question : The Boston Powerlower Botanists at UMass Boston recently discovered a new local lower species
More informationEx code
Ex. 8.4 7-4-2-1 code Codeconverter 7-4-2-1-code to BCD-code. When encoding the digits 0... 9 sometimes in the past a code having weights 7-4-2-1 instead of the binary code weights 8-4-2-1 was used. In
More informationData Compression Techniques
Data Compression Techniques Part 1: Entropy Coding Lecture 4: Asymmetric Numeral Systems Juha Kärkkäinen 08.11.2017 1 / 19 Asymmetric Numeral Systems Asymmetric numeral systems (ANS) is a recent entropy
More informationBachet s equation and groups formed from solutions in Z p
Bachet s equation and groups formed from solutions in Z p Boise State University April 30, 2015 Elliptic Curves and Bachet s Equation Elliptic curves are of the form y 2 = x 3 + ax + b Bachet equations
More informationCS257 Discrete Quantum Computation
CS57 Discrete Quantum Computation John E Savage April 30, 007 Lect 11 Quantum Computing c John E Savage Classical Computation State is a vector of reals; e.g. Booleans, positions, velocities, or momenta.
More information