OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
If you are preparing to appear for Oracle Certified Professional Java SE 8 Programmer (OCPJP 8) certification exam, this a reference card (sort of long cheat sheet) meant to help you. You may want to print this reference card for your easy and quick reference when you prepare for your exam.
Be Smart, Constrain Your Types to Free Your Brain!Jorge Vásquez
The document discusses different approaches to representing data with smart types in Scala to validate data at compile time. It describes using smart constructors with Either types, the Newtype library, and the Refined library to define types for a Person case class that validate fields like names, emails and addresses. Using these approaches helps prevent invalid data from being stored by catching errors at compile time rather than runtime.
Kotlin InDepth Tutorial for beginners 2022Simplilearn
This tutorial by Simplilearn is based on Kotlin In-Depth Tutorial for 2022. This video is curated by industry experts based on the current IT standards and organized in the learning order. This Kotlin tutorial will help you with the fundamentals of kotlin programming language and also Android development with kotlin. This kotlin tutorial will guide you with critical skills, tips, and tricks required to be an expert in kotlin programming language.
In this tutorial, on the Kotlin tutorial, we will be learning about the important topics and basics of Kotlin language that one should know to understand Kotlin language. In this Kotlin tutorial for beginners, we will be learning about the Variables in Kotlin, String templates, if-else, and when statements. We will also learn about arrays, loops, ranges, and much more with help of hands-on examples.
This document discusses handling of character strings in C programming. It covers declaring and initializing string variables as character arrays, reading strings from the terminal using scanf() and gets(), writing strings to the screen using printf() and puts(), performing arithmetic operations and comparisons on characters, concatenating strings, and commonly used string handling functions like strcpy(), strcat(), and strcmp().
This document discusses Java strings including declaration and initialization of strings, length of strings, accessing individual characters, string assignment, string concatenation, comparing strings, converting case, hashcodes, and some HackerRank challenges involving strings. It covers declaring and initializing strings, getting the length, accessing characters at indexes, concatenating strings with +, comparing strings with equals() instead of ==, converting case with toLowerCase(), and how hashcodes can change when modifying strings.
The document provides an agenda for a talk on modeling a Rubik's Cube in JavaScript. It begins with an introduction to scripting languages and ECMAScript. It then discusses modeling a Rubik's Cube by first walking through the code, then modeling the cube and finding moves to solve it. The document covers topics like scripting languages, ECMAScript, object-oriented programming concepts in JavaScript, and modeling a Rubik's Cube to be manipulated programmatically.
This document provides information about arrays in PHP. It discusses numeric arrays, associative arrays, and multidimensional arrays. It explains how to create, iterate through, modify, and handle arrays in PHP. Various functions are described, including count(), print_r(), foreach(), array_slice(), and array_merge(). Multidimensional arrays are given as examples to demonstrate nested arrays and how to access elements within them using loops. Methods for splitting and merging arrays are also covered.
OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
If you are preparing to appear for Oracle Certified Professional Java SE 8 Programmer (OCPJP 8) certification exam, this a reference card (sort of long cheat sheet) meant to help you. You may want to print this reference card for your easy and quick reference when you prepare for your exam.
Be Smart, Constrain Your Types to Free Your Brain!Jorge Vásquez
The document discusses different approaches to representing data with smart types in Scala to validate data at compile time. It describes using smart constructors with Either types, the Newtype library, and the Refined library to define types for a Person case class that validate fields like names, emails and addresses. Using these approaches helps prevent invalid data from being stored by catching errors at compile time rather than runtime.
Kotlin InDepth Tutorial for beginners 2022Simplilearn
This tutorial by Simplilearn is based on Kotlin In-Depth Tutorial for 2022. This video is curated by industry experts based on the current IT standards and organized in the learning order. This Kotlin tutorial will help you with the fundamentals of kotlin programming language and also Android development with kotlin. This kotlin tutorial will guide you with critical skills, tips, and tricks required to be an expert in kotlin programming language.
In this tutorial, on the Kotlin tutorial, we will be learning about the important topics and basics of Kotlin language that one should know to understand Kotlin language. In this Kotlin tutorial for beginners, we will be learning about the Variables in Kotlin, String templates, if-else, and when statements. We will also learn about arrays, loops, ranges, and much more with help of hands-on examples.
This document discusses handling of character strings in C programming. It covers declaring and initializing string variables as character arrays, reading strings from the terminal using scanf() and gets(), writing strings to the screen using printf() and puts(), performing arithmetic operations and comparisons on characters, concatenating strings, and commonly used string handling functions like strcpy(), strcat(), and strcmp().
This document discusses Java strings including declaration and initialization of strings, length of strings, accessing individual characters, string assignment, string concatenation, comparing strings, converting case, hashcodes, and some HackerRank challenges involving strings. It covers declaring and initializing strings, getting the length, accessing characters at indexes, concatenating strings with +, comparing strings with equals() instead of ==, converting case with toLowerCase(), and how hashcodes can change when modifying strings.
The document provides an agenda for a talk on modeling a Rubik's Cube in JavaScript. It begins with an introduction to scripting languages and ECMAScript. It then discusses modeling a Rubik's Cube by first walking through the code, then modeling the cube and finding moves to solve it. The document covers topics like scripting languages, ECMAScript, object-oriented programming concepts in JavaScript, and modeling a Rubik's Cube to be manipulated programmatically.
This document provides information about arrays in PHP. It discusses numeric arrays, associative arrays, and multidimensional arrays. It explains how to create, iterate through, modify, and handle arrays in PHP. Various functions are described, including count(), print_r(), foreach(), array_slice(), and array_merge(). Multidimensional arrays are given as examples to demonstrate nested arrays and how to access elements within them using loops. Methods for splitting and merging arrays are also covered.
Constants, Variables and Data Types in JavaAbhilash Nair
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
This document discusses Java string classes and their differences. It provides an overview of strings in Java and describes the String, StringBuffer, and StringBuilder classes. The String class represents immutable strings and stores strings in a constant pool for efficiency. The StringBuffer and StringBuilder classes represent mutable strings but StringBuffer is synchronized for thread-safety while StringBuilder is not.
The document discusses Java's primitive data types including their ranges and literal constants. It covers char, boolean, byte, short, int, long, float, and double data types. It also discusses variables, symbolic constants, and arithmetic operators.
This document provides an agenda for a Java 8 training session that covers Lambdas and functional interfaces, the Stream API, default and static methods in interfaces, Optional, the new Date/Time API, and Nashorn JavaScript engine. It includes sections on Lambda expressions and method references syntax, functional interfaces, built-in functional interfaces, streams versus collections, using Optional to avoid null checks, extending interfaces with default methods, and key concepts of the new Date/Time and Nashorn JavaScript APIs.
The document discusses various concepts related to using packages in PL/SQL, including overloading subprograms, forward declarations, package initialization blocks, persistent state of package variables, using PL/SQL tables of records in packages, wrapping PL/SQL code into a standalone utility, and utilizing Oracle-supplied packages like DBMS_OUTPUT and UTL_FILE for debugging and file processing.
The document describes a C program that implements various operations on arrays, strings, and stacks. It includes functions to create, display, insert, and delete elements from an array. For strings, it includes functions to read main, pattern, and replace strings, find occurrences of a pattern, and replace the pattern with the given string. For stacks, it includes functions to push and pop elements, check if a number is a palindrome, and display stack elements. The program uses menus to select these different operations and test cases are provided to demonstrate the output.
This document discusses string handling functions in C programming. It defines a string as an array of characters and introduces the string.h header file, which contains functions for manipulating strings like strlen(), strcmp(), strcmpi(), strcpy(), and strcat(). It explains what each function does, including getting the length of a string, comparing strings, copying one string to another, and concatenating two strings.
The document discusses stacks and their applications. It provides 3 key points:
1. A stack is an abstract data type that follows LIFO (last-in, first-out) principles with push and pop operations. Functions like stack_full and stack_empty are used to implement stacks.
2. Stacks have applications in converting infix notation to postfix notation and evaluating postfix expressions. The algorithms pop and push operators and operands to produce the postfix form or calculate values.
3. Examples show converting the infix expression (A * B + (C - D / E)) to postfix AB*C(D-F/)++ and evaluating the postfix form of True, False, NOT, AND,
This document summarizes key concepts about packages, classes, and the static keyword in Java. It discusses how packages are used to organize classes and prevent naming conflicts. It also explains that the static keyword in Java is used for memory management and that static variables, methods, blocks, and nested classes belong to the class rather than object instances. The document provides examples of how to define packages and use the static keyword with variables, methods, and blocks in Java programs.
An Introduction to Programming in Java: ArraysMartin Chapman
An Introduction to Programming in Java: Arrays. Last delivered in 2012. All educational material listed or linked to on these pages in relation to King's College London may be provided for reference only, and therefore does not necessarily reflect the current course content.
This document discusses different types of arrays and sorting/searching algorithms in C programming. It defines one-dimensional, two-dimensional, and multi-dimensional arrays. It also explains linear search, binary search, bubble sort, and selection sort algorithms - including their applications, merits, and demerits. Key array types include static arrays declared at compile-time with a fixed size, and dynamic arrays allocated at runtime using functions like malloc().
Exploring ZIO Prelude: The game changer for typeclasses in ScalaJorge Vásquez
The document discusses ZIO Prelude, a Scala library that provides typeclasses. It motivates ZIO Prelude by explaining limitations of Scalaz in Scala compared to Haskell. It then provides an overview and tour of capabilities in ZIO Prelude, including validating data with Validation to accumulate all errors, combining nested data structures by summing stats, and executing pure computations. The document uses examples to demonstrate how ZIO Prelude provides a more Scala-centric approach to functional programming compared to porting Haskell concepts.
The document discusses C programs to check if a number is a perfect number, Armstrong number, prime number, strong number, or odd/even number. It provides the definitions and logic for each type of number. Code examples with explanations are given to check if a number matches the criteria and print the results. The code can check for a single number or range of numbers for each type.
The document discusses stacks and their implementation. It introduces stacks and their common operations like push and pop. It describes using stacks to solve problems like reversing a list, calculating in Reverse Polish Notation, and bracket matching by keeping track of opening brackets on a stack. Sample code is provided to implement a stack class with methods like push, pop and top to manipulate items on the stack.
Window functions enable calculations across partitions of rows in a result set. This document discusses window function syntax, types of window functions available in MySQL 8.0 like RANK(), DENSE_RANK(), ROW_NUMBER(), and provides examples of queries using window functions to analyze and summarize data in partitions.
The document discusses various aspects of arrays in C programming language. It defines arrays as collections of similar data types stored in contiguous memory locations. It describes single dimensional and multi-dimensional arrays. It also discusses array declaration and initialization syntax. Some key points covered are: advantages of arrays over single variables, accessing array elements using indexes, passing arrays to functions, and two dimensional or 2D arrays also called matrices.
The document discusses arrays in C++. It explains one-dimensional and two-dimensional arrays, how to declare, initialize, and access elements of arrays. Key points include arrays storing a collection of like-typed data, being indexed starting from 0, initializing during declaration, and accessing two-dimensional array elements requiring row and column indices. Examples are provided to demonstrate array concepts.
Constants, Variables and Data Types in JavaAbhilash Nair
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
This document discusses Java string classes and their differences. It provides an overview of strings in Java and describes the String, StringBuffer, and StringBuilder classes. The String class represents immutable strings and stores strings in a constant pool for efficiency. The StringBuffer and StringBuilder classes represent mutable strings but StringBuffer is synchronized for thread-safety while StringBuilder is not.
The document discusses Java's primitive data types including their ranges and literal constants. It covers char, boolean, byte, short, int, long, float, and double data types. It also discusses variables, symbolic constants, and arithmetic operators.
This document provides an agenda for a Java 8 training session that covers Lambdas and functional interfaces, the Stream API, default and static methods in interfaces, Optional, the new Date/Time API, and Nashorn JavaScript engine. It includes sections on Lambda expressions and method references syntax, functional interfaces, built-in functional interfaces, streams versus collections, using Optional to avoid null checks, extending interfaces with default methods, and key concepts of the new Date/Time and Nashorn JavaScript APIs.
The document discusses various concepts related to using packages in PL/SQL, including overloading subprograms, forward declarations, package initialization blocks, persistent state of package variables, using PL/SQL tables of records in packages, wrapping PL/SQL code into a standalone utility, and utilizing Oracle-supplied packages like DBMS_OUTPUT and UTL_FILE for debugging and file processing.
The document describes a C program that implements various operations on arrays, strings, and stacks. It includes functions to create, display, insert, and delete elements from an array. For strings, it includes functions to read main, pattern, and replace strings, find occurrences of a pattern, and replace the pattern with the given string. For stacks, it includes functions to push and pop elements, check if a number is a palindrome, and display stack elements. The program uses menus to select these different operations and test cases are provided to demonstrate the output.
This document discusses string handling functions in C programming. It defines a string as an array of characters and introduces the string.h header file, which contains functions for manipulating strings like strlen(), strcmp(), strcmpi(), strcpy(), and strcat(). It explains what each function does, including getting the length of a string, comparing strings, copying one string to another, and concatenating two strings.
The document discusses stacks and their applications. It provides 3 key points:
1. A stack is an abstract data type that follows LIFO (last-in, first-out) principles with push and pop operations. Functions like stack_full and stack_empty are used to implement stacks.
2. Stacks have applications in converting infix notation to postfix notation and evaluating postfix expressions. The algorithms pop and push operators and operands to produce the postfix form or calculate values.
3. Examples show converting the infix expression (A * B + (C - D / E)) to postfix AB*C(D-F/)++ and evaluating the postfix form of True, False, NOT, AND,
This document summarizes key concepts about packages, classes, and the static keyword in Java. It discusses how packages are used to organize classes and prevent naming conflicts. It also explains that the static keyword in Java is used for memory management and that static variables, methods, blocks, and nested classes belong to the class rather than object instances. The document provides examples of how to define packages and use the static keyword with variables, methods, and blocks in Java programs.
An Introduction to Programming in Java: ArraysMartin Chapman
An Introduction to Programming in Java: Arrays. Last delivered in 2012. All educational material listed or linked to on these pages in relation to King's College London may be provided for reference only, and therefore does not necessarily reflect the current course content.
This document discusses different types of arrays and sorting/searching algorithms in C programming. It defines one-dimensional, two-dimensional, and multi-dimensional arrays. It also explains linear search, binary search, bubble sort, and selection sort algorithms - including their applications, merits, and demerits. Key array types include static arrays declared at compile-time with a fixed size, and dynamic arrays allocated at runtime using functions like malloc().
Exploring ZIO Prelude: The game changer for typeclasses in ScalaJorge Vásquez
The document discusses ZIO Prelude, a Scala library that provides typeclasses. It motivates ZIO Prelude by explaining limitations of Scalaz in Scala compared to Haskell. It then provides an overview and tour of capabilities in ZIO Prelude, including validating data with Validation to accumulate all errors, combining nested data structures by summing stats, and executing pure computations. The document uses examples to demonstrate how ZIO Prelude provides a more Scala-centric approach to functional programming compared to porting Haskell concepts.
The document discusses C programs to check if a number is a perfect number, Armstrong number, prime number, strong number, or odd/even number. It provides the definitions and logic for each type of number. Code examples with explanations are given to check if a number matches the criteria and print the results. The code can check for a single number or range of numbers for each type.
The document discusses stacks and their implementation. It introduces stacks and their common operations like push and pop. It describes using stacks to solve problems like reversing a list, calculating in Reverse Polish Notation, and bracket matching by keeping track of opening brackets on a stack. Sample code is provided to implement a stack class with methods like push, pop and top to manipulate items on the stack.
Window functions enable calculations across partitions of rows in a result set. This document discusses window function syntax, types of window functions available in MySQL 8.0 like RANK(), DENSE_RANK(), ROW_NUMBER(), and provides examples of queries using window functions to analyze and summarize data in partitions.
The document discusses various aspects of arrays in C programming language. It defines arrays as collections of similar data types stored in contiguous memory locations. It describes single dimensional and multi-dimensional arrays. It also discusses array declaration and initialization syntax. Some key points covered are: advantages of arrays over single variables, accessing array elements using indexes, passing arrays to functions, and two dimensional or 2D arrays also called matrices.
The document discusses arrays in C++. It explains one-dimensional and two-dimensional arrays, how to declare, initialize, and access elements of arrays. Key points include arrays storing a collection of like-typed data, being indexed starting from 0, initializing during declaration, and accessing two-dimensional array elements requiring row and column indices. Examples are provided to demonstrate array concepts.
The document discusses arrays in C programming. It defines an array as a collection of similar data elements stored in adjacent memory locations that share a single name. Arrays allow storing multiple values of the same type using this single name. The document covers array declaration syntax, initialization, passing arrays to functions, and multidimensional arrays. It provides examples of one-dimensional and two-dimensional arrays as well as operations like matrix addition and transpose.
The document discusses arrays and multi-dimensional arrays in C programming. It defines arrays as collections of homogeneous data elements indexed by integers, and multi-dimensional arrays as arrays with more than one dimension where each additional dimension requires another pair of brackets. Examples are provided to demonstrate one-dimensional and two-dimensional arrays, including programs to input, output, sort and manipulate array elements. Common array operations like traversing, accessing, and declaring arrays of various types are also explained.
An array is a collection of data items stored at contiguous memory locations. Arrays can have one or more dimensions. A one-dimensional array is declared with the data type, array name, and size. Elements are accessed using indexes within brackets. Two-dimensional arrays are declared with the data type, array name with two sets of brackets and sizes. Elements are accessed using row and column indexes. Arrays can be passed to functions by passing a pointer to the first element or by passing the entire array. Array elements can be accessed and modified within functions.
Arrays allow storing multiple values of the same type. Arrays in C can be declared with the array name, element type, and size. Values can be initialized during or after declaration. Common operations on arrays include sorting, searching, and calculating statistics. Bubble sort iteratively compares and swaps adjacent elements to sort an array in ascending order. Linear search compares each element to a search key, while binary search divides the sorted array in half on each step. Binary search has lower computational complexity of O(log n) compared to O(n) for linear search.
The document discusses arrays in C programming. Some key points include:
- An array is a collection of variables of the same type referred to by a common name. Each element has an index and arrays use contiguous memory locations.
- Arrays are declared with the type, name, and size. The first element is at index 0.
- One-dimensional arrays can be initialized, accessed, input from and output to the user. Multidimensional arrays like 2D arrays represent tables with rows and columns.
- Arrays can be passed to functions by passing the entire array or individual elements. Operations like searching, sorting and merging can be performed on arrays.
An array is a collection of data that holds a fixed number of values of the same type. Arrays can be one-dimensional or multidimensional. Array elements are accessed using indices starting from 0. Arrays can be passed to functions by passing the array name, which passes the base address. Strings in C are implemented as character arrays terminated by a null character. Common string functions like strcpy(), strcat(), strlen() etc. are used to manipulate strings.
The document provides information about arrays, strings, and character handling functions in C language. It discusses:
1. Definitions and properties of arrays, including declaring, initializing, and accessing single and multi-dimensional arrays.
2. Built-in functions for testing and mapping characters from the ctype.h library, including isalnum(), isalpha(), iscntrl(), isdigit(), ispunct(), and isspace().
3. Strings in C being arrays of characters terminated by a null character. It discusses common string handling functions from string.h like strlen(), strrev(), strlwr(), strupr(), strcpy(), strcat(), and strcmp().
The document discusses arrays and strings in C programming. It covers topics like declaring and initializing single and multi-dimensional arrays, accessing array elements, passing arrays to functions, and common array operations like sorting, calculating average and standard deviation. Strings are also introduced as arrays of characters terminated by a null character. Examples are provided for many array concepts and operations.
1. An array is a group of variables of the same type referred to by a common name. Arrays can have one or more dimensions.
2. A one-dimensional array stores elements in contiguous memory locations. Elements are accessed using an index number within square brackets.
3. Common array operations include initializing values, accessing individual elements, searching for elements, finding the maximum/minimum value, and performing element-wise operations on multiple arrays.
1) The document discusses arrays in C programming, including what arrays are, how to declare and initialize one-dimensional arrays, and how to perform common operations like reading, writing, summing, and finding largest elements in arrays.
2) Examples are provided to demonstrate how to write programs to read and display arrays, calculate sums of array elements, and determine other properties of arrays.
3) Key concepts covered include declaring arrays, initializing arrays, accessing array elements, looping through arrays, and performing calculations using the elements of arrays.
Arrays & Strings can be summarized as follows:
1. Arrays are fixed-size collections of elements of the same data type that are used to store lists of related data. They can be one-dimensional, two-dimensional, or multi-dimensional.
2. Strings in C are arrays of characters terminated by a null character. They are commonly used to store text data. Common string operations include reading, writing, combining, copying, comparing, and extracting portions of strings.
3. Arrays are declared with a data type, name, and size. They can be initialized with a block of comma-separated values. Individual elements are accessed using indexes in square brackets. Two-dimensional arrays represent tables
1. An array is a collection of data that holds a fixed number of values of the same type. Arrays allow storing multiple values in a single variable.
2. Arrays can have one dimension (1D), two dimensions (2D), or more dimensions. A 1D array stores values in a list, while a 2D array can be thought of as a table with rows and columns.
3. Array elements can be accessed using indices, with the first element having index 0. The last element of an array of size n has index n-1. Arrays must be initialized before use to assign starting values to elements.
Here are the function definitions and declarations to transfer the variables and arrays between main and the function as specified:
(a)
float func1(float a, float b, int jstar[20]) {
float x;
// function body
return x;
}
int main() {
float a, b;
int jstar[20];
float x = func1(a, b, jstar);
}
(b)
float func2(int n, char c, double values[50]) {
float x;
// function body
return x;
}
int main() {
int n;
char c;
double values[50
An array is a collection of data that holds a fixed number of values of the same type. Arrays allow storing multiple values in a single variable through indices. There are one-dimensional, two-dimensional, and multi-dimensional arrays. One-dimensional arrays use a single subscript, two-dimensional arrays use two subscripts like rows and columns, and multi-dimensional arrays can have more than two subscripts. Arrays can be initialized during declaration with values or initialized at runtime by user input or other methods. Elements are accessed using their indices and operations can be performed on the elements.
An array is a collection of data that holds a fixed number of values of the same type. Arrays allow storing multiple values in a single variable through indices. There are one-dimensional, two-dimensional, and multi-dimensional arrays. One-dimensional arrays use a single subscript, two-dimensional arrays use two subscripts like rows and columns, and multi-dimensional arrays can have more than two subscripts. Arrays can be initialized during declaration with values or initialized at runtime by user input or other methods. Elements are accessed using their indices and operations can be performed on the elements.
This document provides information about arrays in C programming. It defines an array as a linear list of homogeneous elements stored in consecutive memory locations. It notes that arrays always start at index 0 and end at size-1. It describes one-dimensional and multi-dimensional arrays. For one-dimensional arrays, it provides examples of declaration, definition, accessing elements, and several programs for operations like input, output, finding the largest element, and linear search. For multi-dimensional arrays, it describes how they are represented and defined with multiple subscript variables. It also includes a program to add two matrices as an example of a two-dimensional array.
Arrays allow storing and accessing multiple values of the same data type. A two-dimensional array represents data in a tabular form and can be used to store values in a matrix. It is declared with two sets of brackets and initialized with nested curly braces. Elements are accessed using two indices, such as array[row][column]. Memory for a two-dimensional array is allocated in a contiguous block, with the first dimension iterating fastest.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
Assessment and Planning in Educational technology.pptxKavitha Krishnan
In an education system, it is understood that assessment is only for the students, but on the other hand, the Assessment of teachers is also an important aspect of the education system that ensures teachers are providing high-quality instruction to students. The assessment process can be used to provide feedback and support for professional development, to inform decisions about teacher retention or promotion, or to evaluate teacher effectiveness for accountability purposes.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
1. Editor: DEBASIS DWIBEDY
ARRAYS in C
Debasis Dwibedy
Assistant Professor*
Dept. CSE, VSSUT, Burla
*Personal Web Site: www.sites.google.com/view/debasis-dwibedy
2. Editor: DEBASIS DWIBEDY
What is an Array
An array is a fixed-size sequenced collection of related data items
of same type sharing a common name.
An array is a derived data type that holds a list of items of same
type.
Unlike the fundamental data types int, char, float, that holds only
one value, an array holds a list of values in contiguous memory
locations.
Example 1: int arr [10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; /* Array of first 10 natural numbers */
Example 2: float r [5] = {10.8, 9.6, 8.4, 11.5, 12.6}; /* Array of rate of interest of 5 banks */
Example 3: char name [8] = {‘D’, ‘E’, ‘B’, ‘A’, ‘S’, ‘I’, ‘S’, ‘0’} ; /* Array of characters*/
3. Editor: DEBASIS DWIBEDY
Types of Arrays
We can use arrays to represent not only simple lists of values but
also tables of data in two or three or more dimensions.
Accordingly, we have following types of arrays.
One –dimensional arrays
Two –dimensional arrays
Multi –dimensional arrays
A list of same type items can be given one variable name
using only one subscript, also known as the row-wise
representation of data. Eg: int arr [10] ;
A table of items can be given one variable name using two
subscripts, also known as the row and column wise
representation of data. Eg: int arr [3][3] ;
C allows arrays of three or more dimensions. The exact
limit is determined by the compiler. Eg: int arr [3][5][12] ;
5. Editor: DEBASIS DWIBEDY
Variable vs. Array
Variable Array
Declaration
data_type variable_name;
Eg. int mark ;
Memory Representation
mark
Declaration
data_type array_name [size] ;
Eg. int mark [5] ;
Memory Representation (column-measure order)
0
1
2
3
4
mark
mark[0]
mark[1]
mark[2]
mark[3]
mark[4]
1000
1002
1004
1006
1008
Real Memory Addresses
Base Address
Values at
Addresses
Array Name
6. Editor: DEBASIS DWIBEDY
Why to use an Array Type
Let’s consider that we need to store and print
a list of 1000 students' marks of an integer
type.
int main(void)
{
/* How long is the declaration and how many variables
used */
int studMark1, studMark2, studMark3, studMark4, …,
…, studMark998, stuMark999, studMark1000;
…
…
return 0;
}
We have to use 1000 variables of integer type to store and
print the marks. (that many variables are hard to remember)
7. Editor: DEBASIS DWIBEDY
Initialization of an Array
Method 1
/* Declaration*/
int mark[5];
/*Initialization*/
mark[0]=40;
mark[1]=45;
mark[2]=50;
mark[3]=35;
mark[4]=42;
Method 2
/* Declaration and
initialization*/
int mark[5]={40,45,50,35,42};
Method 3
/* Declaration and
initialization*/
int mark []={40,45,50,35,42} ;
Method 4
/* Declaration */
int mark [5], i ;
/* Initialization */
printf (“Enter 5 marks”) ;
for (i = 0 ; i < 5 ; i++)
{
scanf(“%d”, &mark[i]) ;
}
Not recommendable to omit
the size of the array, while
declaration and initialization
take place at the same time.
8. Editor: DEBASIS DWIBEDY
Character Array and String
/* Declaration and initialization*/
char name[9]={‘w’, ‘E’, ‘L’, ‘ ’, ‘C’, ‘O’, ‘M’, ‘E’, ‘0’};
‘W’
‘E’
‘L’
‘ ’
‘C’
‘O’
‘M’
‘E’
‘0’
0
1
2
3
4
5
6
7
8
/* Declaration and initialization*/
char name[9]={“WEL COME”};
Rule: The size of a character
array must be one more than
the number of characters to
be stored in memory or to be
displayed on the console. The
extra space is required to
store the “o” character to tell
the compiler explicitly about
the end of the array.
9. Editor: DEBASIS DWIBEDY
Array Initialization Tips
Error 1
/* Initializers are more than the
declared size*/
int mark[3]={40,45,50,35,42};
If we have more initializers, than the
declared size of the array, then the
compiler generates an error.
No Error
/* Initializers are less than the
declared size*/
int mark[5]={40,45,50};
If we have less initializers, than the
declared size of the array, then the
compiler does not generate an error
and allocates 0s to the vacant
locations of the integer array and ‘0’
to the character array.
No Error
/* Any reference to the array
outside the declared limit*/
int mark[5]={40,45,50, 35, 42};
printf(“%d”, mark[6]);
It would not cause an error, it outputs
a garbage value.
10. Editor: DEBASIS DWIBEDY
Run-Time Initialization of Array
Any array can also be initialized at run time explicitly. This
approach is useful for large arrays.
Example
/* Declaration */
int mark[100], i ;
/* Initialization */
for(i=0; i<100; i++)
{
if (i < 50)
mark[i]=45;
else
mark[i]=90;
}
11. Editor: DEBASIS DWIBEDY
Skeleton of a Program
Basic structure of a program that uses arrays.
#include<stdio.h>
void main()
{
/* Declaration of array and variables */
Declaration statements;
/* Initialization of array and variables */
Initialization statements;
/* Program Logic */
Logic statements;
/* Print the result */
Using for loops to print the array elements;
}
12. Editor: DEBASIS DWIBEDY
Program-1
W.A.P to display the sum of squares of any 10 real numbers.
#include<stdio.h>
void main()
{
/* Declaration */
int i ;
float arr[10], value, total=0.0 ;
/* Initialization of the Array*/
printf(“Enter values to the array”);
for(i = 0; i < 10; i++)
{
scanf(“%f”, &value);
arr[i] = value;
}
/* Print the Result*/
printf(“n total = %f”, total);
}
/* Computation of Total*/
for(i = 0; i < 10; i++)
{
total = total + arr[i] * arr[i];
}
13. Editor: DEBASIS DWIBEDY
Program-2
W.A.P that interchanges the odd and even positioned elements of an
array.
#include<stdio.h>
void main()
{
/* Logic*/
for (i = 0 ; i < n ; i = i+2)
{
t = num [i] ;
num [i] = num [i+1] ;
num [i+1] = t ;
}
/ * Print the Resultant Array * /
for ( i = 0 ; i < n ; i++ )
{
printf( “ %d”, num [i] ) ;
}
return 0 ;
}
/* Declaration */
int num[], i, n, t ;
/* Initialization of the Array*/
printf (“Enter size of the arrayn”) ;
scanf(“%d”, &n) ;
printf(“Enter elementsn”);
for(i = 0 ; i < n ; i++)
{
scanf(“%d”, &num[i]) ;
}
14. Editor: DEBASIS DWIBEDY
Program-3
Enter 5 students marks and display the percentage obtained by
each student as output.
#include<stdio.h>
void main()
{
/* Declaration */
int std[5], m1, m2, m3, m4, m5, i ;
/* Logic */
for(i=0; i<5; i++)
{
printf(“Enter marks of 5 subjects
of student %d”, i);
scanf(“%d%d%d%d%d”, &m1,
&m2, &m3, &m4, &m5);
std[i]=(m1+m2+m3+m4+m5)/5;
}
/* Print Results*/
for(i=0; i<5; i++)
{
printf(“%d”, std[i]);
}
}
15. Editor: DEBASIS DWIBEDY
Program-4
Enter 5 students marks into an array and sort the marks in an
ascending order.
Logic Execution of Iteration 1
for(i = 0 ; i < 5 ; i++)
{
j = i ;
for (k = i+1 ; k < 5 ; k++)
{
if (std [k] < std [i])
{
j = k ;
/* Swap the values of std [i] and std [j] */
temp = std [i] ;
std [i] = std [j] ;
std [j] = temp;
}
}
40 35 50 20 10
i, j k
40 35 50 20 10
k, j
i
35 40 50 20 10
i j k
35 40 50 20 10
i j k
35 40 50 20 10
k, j
i
16. Editor: DEBASIS DWIBEDY
Execution Continues
20 40 50 35 10
i j k
20 40 50 35 10
k, j
i
10 40 50 35 20
i j k
10 40 50 35 20
i j k
Termination of Iteration- 1 of outer For loop
Execution of Iteration 2
10 40 50 35 20
i, j k
17. Editor: DEBASIS DWIBEDY
Program-4 (Code)
Enter 5 students marks into an array and sort the marks in an
ascending order.
#include<stdio.h>
void main()
{
/* Declaration */
int std [5] = {40, 35, 50, 20, 10} ;
int i, j, k, temp ;
/* Logic */
for(i = 0 ; i < 5 ; i++)
{
j = i ;
for (k = i+1 ; k < 5 ; k++)
{
if (std [k] < std [i])
{
j = k ;
temp = std [i] ;
std [i] = std [j] ;
std [j] = temp;
}
}
/* Print the sorted Array*/
for(i = 0 ; i < 5 ; i++)
{
printf(“%dn”, std[i]);
}
}
18. Editor: DEBASIS DWIBEDY
Program-5
Given an array of n integers. W.A.P to find whether a number is
present in the array, if present, then print its position in the array.
#include<stdio.h>
int main()
{
/* Declaration */
int arr [], n, i, key ;
/* To know size of the Array */
printf(“Enter the number of
elements in the arrayn”) ;
scanf(“%d”, &n);
/* Initialization of the Array */
printf(“Enter %d numbersn”, n) ;
for (i = 0 ; i < n ; i++)
scanf(“%d”, &arr[i]);
/* Search Logic */
printf(“Enter the number to searchn”);
scanf(“%d”, &key);
for (i = 0 ; i < n ; i++ )
{
if (arr [i] = = key)
{
printf(“%d is present at position
%d n”, key, i+1);
break; } }
if (i = = n) {
printf (“%d is not present in the array”,
key);
return 0;
}
19. Editor: DEBASIS DWIBEDY
Program-6
W.A.P to copy the contents of one array of size 5 into another in the
reverse order.
#include<stdio.h>
void main()
{
/* Logic*/
for (i = 0, j = 4 ; i < 5 ; i++, j--)
{
arr2 [j] = arr1 [i] ;
}
/ * Print the Resultant Array * /
for ( i = 0 ; i < 5 ; i++ )
{
printf( “ n%d”, arr2 [i] ) ;
}
return 0 ;
}
/* Declaration */
int arr1[5], arr2 [5], i, j ;
/* Initialization of the Array 1*/
printf(“Enter 5 elements into array
n”);
for(i = 0 ; i < 5 ; i++)
{
scanf(“%d”, &arr1[i]) ;
}
20. Editor: DEBASIS DWIBEDY
Assignments
1. W.A.P to find the smallest and largest number in an array of n integers.
2. W.A.P to sort an array of n positive integers in descending order.
3. W.A.P to find the occurance of 1, 2, 3 in an array of following items
1, 2, 2, 3, 3, 2, 2, 1, 2, 1, 1, 1, 3, 2, 3, 3, 1, 2, 3, 1, 2, 3, 1.
4. W.A.P to find the mean and standard deviation of an array of n positive
integers.
5. Given are two one-dimensional arrays A and B which are sorted in
ascending order. W. A. P. to merge them into a single sorted array C that
contains every items from array A and B in ascending order.
6. Given an array of n positive integers. W.A.P to reverse the array elements.
22. Editor: DEBASIS DWIBEDY
Definition
A 2-dimensional array represents a table of data in rows and columns
A table of items can be given one variable name using two subscripts
Eg: int m [5][5] ;
A 2-dimensional array is also called a matrix.
A 2-dimensional array is an amalgamation of several 1-D arrays.
23. Editor: DEBASIS DWIBEDY
Why to use a 2-D Array
Let’s consider that we need to store and print
the marks of 5 students in 5 subjects.
int main(void)
{
/* How long is the declaration and how many arrays are
used */
int std_1[5], std_2[5], std_3[5], std_4[5], std_5[5];
…
…
return 0;
}
We have to use 5 one-dimensional arrays of integer type with
5 rows to store 5 subjects marks of each students. (that many
arrays are hard to remember and maintain for a large program)
24. Editor: DEBASIS DWIBEDY
Why to use a 2-D Array
Can a single array be used to store and
display the marks of all 5 students ?
Yes, by a 2-D Array
Advantages
1. Number of 1-D array declarations can be reduced significantly.
2. It is convenient to remember and maintain a minimum number
of arrays.
25. Editor: DEBASIS DWIBEDY
Declaration
/* Declaration */
data_type array_name [row_size][column_size];
/* Example*/
int m [3][5] ; /* the compiler allocates 30 Bytes in contiguous memory locations */
Row 0
Row 1
Row 2
m[0][0] m[0][1] m[0][2] m[0][3] m[0][4]
m[1][0] m[1][1] m[1][2] m[1][3] m[1][4]
m[2][0] m[2][1] m[2][2] m[2][3] m[2][4]
0
1
2
0 1 2 3 4
Logical Representation of a 2-D Array
Accessing a 2-D array element by: array_name [row i][column j]
/* Example*/
printf ( “%d”, m [1][4] ) ; /* it will print value at location 2nd row and 5th column
Tabular
Form
26. Editor: DEBASIS DWIBEDY
Memory Layout
Lets consider the following 2-D array
Eg: int m [3][3] ;
How a 2-dimensional array is stored in the memory?
m[0][0] m[0][1] m[0][2] m[1][0] m[1][1] m[1][2] m[2][0] m[2][1] m[2][2]
Row 0 Row 1 Row 2
1000 1002 1004 1006 1008 1010 1012 1014 1016
Row-measure Representation of 2-D Array in Memory
printf(“The size of the array is %d Bytes”, sizeof(m)); /* The size of the array is 18 Bytes */
printf(“%u%u%u”, m+0, m+1, m+2)); /* 1000 1006 1012 */
27. Editor: DEBASIS DWIBEDY
Initialization
Method 1
/* Declaration*/
int m [2][2];
/*Initialization*/
m[0][0] = 40 ;
m[0][1] = 45 ;
m[1][0] = 50 ;
m[1][1] = 35 ;
Method 2
/* Declaration and
initialization*/
int m[2][2] = {
{40,45}, {50,35}
} ;
Method 3
/* Declaration and
initialization*/
int m[][2] = {
40, 45, 50, 35
} ;
Method 4
/* Declaration */
int m[2][2], i, j ;
/* Initialization */
printf (“Enter marks”) ;
for (i = 0 ; i < 2 ; i++)
{
for (j = 0 ; j < 2 ; j++)
scanf(“%d”, &m[i][j] );
}
Row size is optional, braces for
individual row is also optional,
but column size is compulsory
in the declaration and
initialization of a 2-D array.
28. Editor: DEBASIS DWIBEDY
Program-1
W.A.P to store and display 3 student marks of 3 different subjects.
#include<stdio.h>
void main()
{
/* Declaration */
int m[3][3], i, j ;
/* Store marks into m[3][3]*/
printf(“Enter marks of 3 studentsn”);
for(i = 0; i < 3; i++)
{
for (j = 0 ; j < 3 ; j++)
scanf(“%d”, &m[i][j]) ;
}
/* To know the size of the declared
m[3][3] */
printf (“%u”, sizeof(m) ) ;
/* Display the marks*/
for(i = 0 ; i < 3 ; i++)
{
for (j = 0 ; j < 3 ; j++)
{
printf(“%dt”, m[i][j]) ;
}
printf(“n”);
}
}
29. Editor: DEBASIS DWIBEDY
Program-2
W.A.P to print the largest number in a 2-D array and its position.
#include<stdio.h>
void main()
{
/* Logic*/
big = a[0][0], r = 0, c = 0 ;
for (i = 0 ; i < row_size ; i++)
{
for (j = 0 ; j < column_size ; j++)
{
if ( a[i][j] > big)
{
big = a[i][j];
r = i, c = j ; }
} }
/ * Print the Result * /
printf(“Largest=%d”, big ) ;
printf(The position of %d is %d th row
and %d th column”, big, r+1, c+1) ;
}
/* Declaration */
int a[][], i, j, big, row_size, column_size, r, c ;
/* Initialization of the Array a[][] */
printf (“Enter row and column sizen”) ;
scanf(“%d%d”, &row_size,
&column_size) ;
printf(“Enter elementsn”);
for(i = 0 ; i < row_size ; i++)
{
for (j = 0 ; j < column_size ; j++)
scanf(“%d”, &a[i][j]) ;
}
30. Editor: DEBASIS DWIBEDY
Transpose of a Matrix
Input Matrix
1
2
3
4
5
6
3 x 2
Interchanging the rows and columns
Resultant Matrix
1 2 3
4 5 6
2 x 3
/* Logic and print the resultant matrix*/
for (i = 0 ; i < column_size ; i++)
{
for (j = 0 ; j < row_size ; j++)
{
printf ( “ %dt”, a [j][i] ) ;
}
printf ( “ n” ) ;
}
31. Editor: DEBASIS DWIBEDY
Program-3
W.A.P to print the transpose of a matrix.
#include<stdio.h>
void main()
{
/* Logic and print the output array*/
for (i = 0 ; i < column_size ; i++)
{
for (j = 0 ; j < row_size ; j++)
{
printf ( “ %dt”, a [j][i] ) ;
}
printf ( “ n” ) ;
}
/* Declaration of 2-D Array and variables */
int a[][], i, j, row_size, column_size ;
/* Initialize and print the input items */
printf (“Enter row and column sizen”) ;
scanf(“%d%d”, &row_size,
&column_size) ;
printf(“Enter elementsn”);
for(i = 0 ; i < row_size ; i++)
{
for (j = 0 ; j < column_size ; j++)
scanf(“%d”, &a[i][j]) ;
printf( “ %d”, a[i][j] ) ;
32. Editor: DEBASIS DWIBEDY
Multiplication of two Matrices
Matrix m1
1
2
3
4
5
6
3 x 2
Resultant Matrix m3
1 2 3
4 5 6
2 x 3
/* Logic of matrix Multiplication */
for (i = 0 ; i < 3 ; i++)
{
for (j = 0 ; j < 3 ; j++)
{
sum = 0 ;
for ( k = 0; k < 2 ; k++ )
sum = sum + m1[i][k] * m2[k][j] ;
m3 [i][j] = sum ;
} }
X
Matrix m2
17 22 27
22 29 36
27 36 45
3 x 3
m3[0][0] = ( m1[0][0]* m2[0][0] ) + ( m1[0][1] * m2[1][0])
m3[0][1] = ( m1[0][0]* m2[0][1] ) + ( m1[0][1] * m2[1][1])
m3[0][2] = ( m1[0][0]* m2[0][2] ) + ( m1[0][1] * m2[1][2])
m3[1][0] = ( m1[1][0]* m2[0][0] ) + ( m1[1][1] * m2[1][0])
m3[1][1] = ( m1[1][0]* m2[0][1] ) + ( m1[1][1] * m2[1][1])
m3[1][2] = ( m1[1][0]* m2[0][2] ) + ( m1[1][1] * m2[1][2])
m3[2][0] = ( m1[2][0]* m2[0][0] ) + ( m1[2][1] * m2[1][0])
m3[2][1] = ( m1[2][0]* m2[0][1] ) + ( m1[2][1] * m2[1][1])
m3[2][2] = ( m1[2[0]* m2[0][2] ) + ( m1[2][1] * m2[1][2])
m X n n X p
m X p
i < m
j < p k < n
33. Editor: DEBASIS DWIBEDY
Program-4
W.A.P to show the multiplication of two 3 X 3 matrices.
#include<stdio.h>
void main()
{
/* Declaration of Arrays and variables */
int m1[3][3], m2[3][3], m3[3][3], i, j, k, sum;
/* Initialize and print items of m1 */
printf(“Enter elementsn”);
for(i = 0 ; i < 3 ; i++)
{
for (j = 0 ; j < 3 ; j++)
{
scanf(“%d”, &m1[i][j]) ;
printf( “ %dt”, m1[i][j] ) ;
}
printf (“ n”);
}
/* Initialize and print items of m2 */
printf(“Enter elementsn”);
for(i = 0 ; i < 3 ; i++)
{
for (j = 0 ; j < 3 ; j++)
{
scanf(“%d”, &m2[i][j]) ;
printf( “ %dt”, m2[i][j] ) ;
}
printf (“ n”);
}
34. Editor: DEBASIS DWIBEDY
Program-4 (contd..)
/* Print new matrx m3 containing the
product*/
printf(“The product of matrix m1 and
m2 is: n”) ;
for(i = 0 ; i < 3 ; i++)
{
for (j = 0 ; j < 3 ; j++)
{
printf( “ %dt”, m3[i][j] ) ;
}
printf (“ n”);
}
}
/* Logic of matrix Multiplication */
for (i = 0 ; i < 3 ; i++)
{
for (j = 0 ; j < 3 ; j++)
{
sum = 0 ;
for ( k = 0; k < 3 ; k++ )
{
sum = sum + m1[i][k] * m2[k][j] ;
}
m3 [i][j] = sum ;
}
}
35. Editor: DEBASIS DWIBEDY
Assignments
1. W.A.P to find the smallest and largest number in a n X n 2-D array.
2. W.A.P to find the 2nd smallest and 2nd largest number in a 3 X3 2-D array.
3. W.A.P to show the inverse of a 3 X 3 matrix.
4. W.A.P to show the multiplication of a m X n matrix with a n X P matrix.
5. A 6 X 6 matrix is entered through the key board. W.A.P to obtain the
determinant of this matrix.
6. W.A.P to add two 5 X 5 matrices and print the sum of elements of the
resultant matrix.
7. A 3 X 3 matrix is entered through key board. W.A.P to check whether
the input matrix is symmetric.