This document discusses inter-thread communication in Java, which allows synchronized threads to communicate with each other. It describes polling as a wasteful process where a thread repeatedly checks a condition, and how inter-thread communication avoids this through wait(), notify(), and notifyAll() methods. These methods, defined in the Object class, allow one thread to pause while another thread executes, with notify() waking one thread and notifyAll() waking all threads. The key difference between wait() and sleep() is that wait() releases the monitor lock while sleeping.
The document discusses exceptions handling in .NET. It defines exceptions as objects that deliver a powerful mechanism for centralized handling of errors and unusual events. It describes how exceptions can be handled using try-catch blocks, and how finally blocks ensure code execution regardless of exceptions. It also covers the Exception class hierarchy, throwing exceptions with the throw keyword, and best practices like ordering catch blocks and avoiding exceptions for normal flow control.
The document discusses graphical user interface (GUI) components in Java. It covers topics like basic GUI units like frames and panels, common Swing components like JFrame, JButton, JTextField, layout managers, event handling using listeners, and examples of creating simple GUI applications in Java. Key concepts explained include the component hierarchy in Swing, commonly used layouts like FlowLayout, BorderLayout and GridLayout, and how to add listeners for events like button clicks and window closing. Code samples are provided to demonstrate creating frames, adding components, setting layouts and handling events.
This document provides the format and contents for a term paper on the game Tic Tac Toe. It includes sections for the title page, table of contents, introduction, proposed system description and requirements, requirement analysis, system design, source code, testing, and future scope. The introduction describes the existing manual system and benefits of the new software system. The proposed system section provides more details on the problem statement, functions, and system requirements. The requirement analysis section describes the system development life cycle. The system design section includes a flowchart illustrating the game play. The source code section lists the C code used to develop the software.
The document discusses Java event handling and the delegation event model. It describes key concepts like events, sources that generate events, and listeners that handle events. It provides examples of registering components as listeners and implementing listener interfaces. The delegation event model joins sources, listeners, and events by notifying listeners when sources generate events.
This document discusses Java Database Connectivity (JDBC) and the steps to connect to a database using JDBC. It provides an overview of JDBC architecture and its main components. It then outlines the key steps to connect to a database which include: 1) driver registration where the appropriate JDBC driver class is loaded, 2) defining the connection URL, 3) establishing a connection, 4) creating SQL statements, 5) executing queries and processing result sets, and 6) closing the connection. Examples are provided for connecting to MySQL and Derby databases using JDBC.
This document discusses control structures in JavaScript, including if/else statements, switch statements, do/while loops, while loops, and for loops. It provides the syntax for each structure and briefly explains their usage. The if statement allows for conditional execution, switch statements evaluate an expression and execute code based on matching cases, do/while loops execute code at least once even if the condition is false, while loops execute code as long as an expression remains true, and for loops include initialization, condition checking, and iteration in a compact loop syntax.
Summary of UNIX commands used in the BTI Plant Bioinformatics Course in 2014. It includes a description of these common commands and some useful options.
This document provides an introduction to XML DOM (Document Object Model) including:
- XML DOM defines a standard for accessing and manipulating XML documents and is a W3C standard.
- The DOM presents an XML document as a tree structure with elements, attributes, and text as nodes.
- The DOM is separated into three levels: Core DOM, XML DOM, and HTML DOM.
- DOM properties and methods allow accessing and modifying nodes, and DOM parsing converts an XML document into accessible DOM objects.
Este documento proporciona instrucciones sobre cómo conectar una aplicación Java a una base de datos. Explica que JDBC es la API de Java para conectividad de bases de datos y describe los pasos para establecer una conexión utilizando DriverManager, incluyendo la creación de un objeto Connection y luego utilizando este objeto para crear objetos Statement y ResultSet para ejecutar consultas SQL y recuperar datos.
This document provides an overview of JavaFX presented by Mansi Babbar. It discusses what JavaFX is, why it is needed, its features and structure. The key components of JavaFX like controls, layouts, charts, media etc. are explained. An example JavaFX application structure and code is given. The presentation ends with a demo of JavaFX.
C is a general-purpose programming language developed between 1969 and 1973 by Dennis Ritchie at Bell Labs. It was created to write the UNIX operating system and became widely popular. Key features of C include being a robust language with built-in functions and operators, producing efficient and fast programs, and being highly portable. C laid the foundation for many other languages and important programs like Linux, PHP, and MySQL are written in C. It does not support object-oriented programming concepts but provides low-level access to memory.
Dart is an open-source programming language developed by Google that is used to build web, server, and mobile applications. It is designed to be familiar to developers from languages like JavaScript, Java, and C# but also supports strong typing. Dart aims to help developers build complex, high-fidelity client apps for the modern web. It compiles to JavaScript to run in the browser or to native code to run mobile apps. Dart supports key features like classes, mixins, asynchronous programming, and isolates for concurrency.
String is an object that represents a sequence of characters. The three main String classes in Java are String, StringBuffer, and StringTokenizer. String is immutable, while StringBuffer allows contents to be modified. Common string methods include length(), charAt(), substring(), indexOf(), and equals(). The StringBuffer class is similar to String but more flexible as it allows adding, inserting and appending new contents.
Este documento explica los diagramas de secuencias, los cuales muestran la interacción entre objetos a lo largo del tiempo. Los diagramas de secuencias contienen objetos, mensajes y una línea de tiempo. Los objetos se representan con rectángulos y envían mensajes entre sí, representados por flechas, para comunicarse de forma síncrona o asíncrona. La línea de tiempo muestra el orden en que ocurren los eventos.
The document discusses various event handling classes in Java including ActionEvent, KeyEvent, MouseEvent, MouseMotionEvent, FocusEvent, WindowEvent, and ItemEvent. It provides examples of how to use each event class by implementing the appropriate listener interface and defining event handling methods. Key points covered include common event handling terms like event, event source, and event listener. It also summarizes the typical methods provided by each event class.
The document discusses monads and functional programming concepts. It begins by explaining that monads are structures that put values in computational contexts. It then provides a technical definition of a monad involving endofunctors, natural transformations, and laws. Several examples are given to illustrate monads, including the Optional monad in Java to handle null values, and the Stream monad to represent sequences. The document advocates using monads to make aspects like errors, state, and effects explicit in a program's type system.
A class defines the data and behavior of a type by grouping together variables, methods, and events. It supports encapsulation by allowing fields and methods to be declared as instance or static members. A class is declared using the class keyword followed by the class name and body surrounded by curly braces. Objects are instances of a class that can access members using the dot operator. Constructors are special methods that initialize an object when created with the new operator.
Selection Statements
Using if and if...else
Nested if Statements
Using switch Statements
Conditional Operator
Repetition Statements
Looping: while, do, and for
Nested loops
Using break and continue
This document discusses Remote Method Invocation (RMI) in Java. It explains that RMI allows a Java object to invoke methods on an object running on another machine, enabling remote communication between Java programs. It then describes the basic concepts of an RMI application including client/server architecture using stub and skeleton objects. Finally, it outlines the steps to implement a simple RMI application with an interface, client, and server classes.
This document provides a summary of common Linux commands organized by category including file permissions, networking, compression/archives, package installation, searching, login, file transfer, disk usage, directory traversal, system information, hardware information, users, file commands, and process related commands. It also includes brief descriptions and examples of commands like chmod, chown, ip, tar, rpm, grep, ssh, df, du, and kill. More detailed information on Linux commands can be found at the provided URL.
Regular expressions are patterns used to match character combinations in strings. They allow concise testing of string properties and manipulation of strings through search, match, and replacement. The document outlines basic regular expression syntax like wildcards, character sets, and flags. It provides examples of using regex to validate input format and extract postal codes and phone numbers through capturing groups. Search finds matches, match returns an array of all matches, and replace substitutes matches using a function.
The document discusses event-driven programming and how it relates to graphical user interfaces and the Alice programming language. Event-driven programming involves event listeners detecting event triggers and responding by running event handler methods. In Alice, programmers can select different event types from a menu and specify event handlers by dragging method tiles. Events are important for creating interactive worlds and are widely used in modern programming languages.
Jdbc example program with access and MySqlkamal kotecha
The document provides examples of using JDBC to connect to and interact with Microsoft Access and MySQL databases. It includes steps to create databases and tables in Access and MySQL, as well as code samples demonstrating how to connect to the databases using JDBC, execute queries using Statement and PreparedStatement, and retrieve and display result sets. Key aspects like loading the appropriate JDBC driver and connection strings for different databases are also explained.
This document provides an introduction and overview of Java applet programming. It discusses what Java and applets are, the applet skeleton structure including common lifecycle methods like init(), start(), paint(), stop(), and destroy(). It also outlines the steps to write an applet code, compile it, and include it in an HTML file using applet tags to display the applet. An example Java applet class and HTML code is provided at the end to demonstrate a simple "Hello World" style applet.
This document provides an overview of Java Server Pages (JSP) technology. Some key points:
- JSP allows separation of work between web designers and developers by allowing HTML/CSS design and Java code to be placed in the same file.
- A JSP page is compiled into a servlet, so it can take advantage of servlet features like platform independence and database-driven applications.
- JSP pages use tags like <jsp:include> and <jsp:useBean> to include content and access JavaBeans. Scriptlets, expressions, declarations, and directives are also used.
- Implicit objects like request, response, out, and session are automatically available in JSP pages
This document describes a C program for a telephone directory. It includes 7 chapters that cover an introduction, problem definition, modules used, implementation details, results, conclusions and future scope, and references. The implementation chapter includes the full code for the telephone directory program. It allows the user to add, display, delete, and save contact entries. The program uses linked lists and functions for various operations like adding, deleting, displaying entries. Screenshots of sample outputs are provided in the results section. The conclusion discusses potential future enhancements like adding fingerprints or photos.
This document provides an overview of Java generics through examples. It begins with simple examples demonstrating how generics can be used to define container classes (BoxPrinter) and pair classes (Pair). It discusses benefits like type safety and avoiding duplication. Further examples show generics with classes, methods, and limitations like erasure. Wildcard types are introduced as a way to overcome some limitations. Key points covered include generic methods, wildcards, raw types and warnings, limitations of wildcards, and issues with readability of generic code.
This document discusses Java 8 concurrency abstractions including asynchronous result processing using CompletableFuture and optimistic locking using StampedLock. It provides an overview and comparison to previous concurrency APIs. The agenda includes exploring CompletableFuture features like asynchronous execution, chaining reactions, and exception handling. It also covers using StampedLock for optimistic reads, comparing it to the previous ReentrantReadWriteLock approach. Examples are shown for common use cases of these new concurrency APIs.
This document provides an introduction to XML DOM (Document Object Model) including:
- XML DOM defines a standard for accessing and manipulating XML documents and is a W3C standard.
- The DOM presents an XML document as a tree structure with elements, attributes, and text as nodes.
- The DOM is separated into three levels: Core DOM, XML DOM, and HTML DOM.
- DOM properties and methods allow accessing and modifying nodes, and DOM parsing converts an XML document into accessible DOM objects.
Este documento proporciona instrucciones sobre cómo conectar una aplicación Java a una base de datos. Explica que JDBC es la API de Java para conectividad de bases de datos y describe los pasos para establecer una conexión utilizando DriverManager, incluyendo la creación de un objeto Connection y luego utilizando este objeto para crear objetos Statement y ResultSet para ejecutar consultas SQL y recuperar datos.
This document provides an overview of JavaFX presented by Mansi Babbar. It discusses what JavaFX is, why it is needed, its features and structure. The key components of JavaFX like controls, layouts, charts, media etc. are explained. An example JavaFX application structure and code is given. The presentation ends with a demo of JavaFX.
C is a general-purpose programming language developed between 1969 and 1973 by Dennis Ritchie at Bell Labs. It was created to write the UNIX operating system and became widely popular. Key features of C include being a robust language with built-in functions and operators, producing efficient and fast programs, and being highly portable. C laid the foundation for many other languages and important programs like Linux, PHP, and MySQL are written in C. It does not support object-oriented programming concepts but provides low-level access to memory.
Dart is an open-source programming language developed by Google that is used to build web, server, and mobile applications. It is designed to be familiar to developers from languages like JavaScript, Java, and C# but also supports strong typing. Dart aims to help developers build complex, high-fidelity client apps for the modern web. It compiles to JavaScript to run in the browser or to native code to run mobile apps. Dart supports key features like classes, mixins, asynchronous programming, and isolates for concurrency.
String is an object that represents a sequence of characters. The three main String classes in Java are String, StringBuffer, and StringTokenizer. String is immutable, while StringBuffer allows contents to be modified. Common string methods include length(), charAt(), substring(), indexOf(), and equals(). The StringBuffer class is similar to String but more flexible as it allows adding, inserting and appending new contents.
Este documento explica los diagramas de secuencias, los cuales muestran la interacción entre objetos a lo largo del tiempo. Los diagramas de secuencias contienen objetos, mensajes y una línea de tiempo. Los objetos se representan con rectángulos y envían mensajes entre sí, representados por flechas, para comunicarse de forma síncrona o asíncrona. La línea de tiempo muestra el orden en que ocurren los eventos.
The document discusses various event handling classes in Java including ActionEvent, KeyEvent, MouseEvent, MouseMotionEvent, FocusEvent, WindowEvent, and ItemEvent. It provides examples of how to use each event class by implementing the appropriate listener interface and defining event handling methods. Key points covered include common event handling terms like event, event source, and event listener. It also summarizes the typical methods provided by each event class.
The document discusses monads and functional programming concepts. It begins by explaining that monads are structures that put values in computational contexts. It then provides a technical definition of a monad involving endofunctors, natural transformations, and laws. Several examples are given to illustrate monads, including the Optional monad in Java to handle null values, and the Stream monad to represent sequences. The document advocates using monads to make aspects like errors, state, and effects explicit in a program's type system.
A class defines the data and behavior of a type by grouping together variables, methods, and events. It supports encapsulation by allowing fields and methods to be declared as instance or static members. A class is declared using the class keyword followed by the class name and body surrounded by curly braces. Objects are instances of a class that can access members using the dot operator. Constructors are special methods that initialize an object when created with the new operator.
Selection Statements
Using if and if...else
Nested if Statements
Using switch Statements
Conditional Operator
Repetition Statements
Looping: while, do, and for
Nested loops
Using break and continue
This document discusses Remote Method Invocation (RMI) in Java. It explains that RMI allows a Java object to invoke methods on an object running on another machine, enabling remote communication between Java programs. It then describes the basic concepts of an RMI application including client/server architecture using stub and skeleton objects. Finally, it outlines the steps to implement a simple RMI application with an interface, client, and server classes.
This document provides a summary of common Linux commands organized by category including file permissions, networking, compression/archives, package installation, searching, login, file transfer, disk usage, directory traversal, system information, hardware information, users, file commands, and process related commands. It also includes brief descriptions and examples of commands like chmod, chown, ip, tar, rpm, grep, ssh, df, du, and kill. More detailed information on Linux commands can be found at the provided URL.
Regular expressions are patterns used to match character combinations in strings. They allow concise testing of string properties and manipulation of strings through search, match, and replacement. The document outlines basic regular expression syntax like wildcards, character sets, and flags. It provides examples of using regex to validate input format and extract postal codes and phone numbers through capturing groups. Search finds matches, match returns an array of all matches, and replace substitutes matches using a function.
The document discusses event-driven programming and how it relates to graphical user interfaces and the Alice programming language. Event-driven programming involves event listeners detecting event triggers and responding by running event handler methods. In Alice, programmers can select different event types from a menu and specify event handlers by dragging method tiles. Events are important for creating interactive worlds and are widely used in modern programming languages.
Jdbc example program with access and MySqlkamal kotecha
The document provides examples of using JDBC to connect to and interact with Microsoft Access and MySQL databases. It includes steps to create databases and tables in Access and MySQL, as well as code samples demonstrating how to connect to the databases using JDBC, execute queries using Statement and PreparedStatement, and retrieve and display result sets. Key aspects like loading the appropriate JDBC driver and connection strings for different databases are also explained.
This document provides an introduction and overview of Java applet programming. It discusses what Java and applets are, the applet skeleton structure including common lifecycle methods like init(), start(), paint(), stop(), and destroy(). It also outlines the steps to write an applet code, compile it, and include it in an HTML file using applet tags to display the applet. An example Java applet class and HTML code is provided at the end to demonstrate a simple "Hello World" style applet.
This document provides an overview of Java Server Pages (JSP) technology. Some key points:
- JSP allows separation of work between web designers and developers by allowing HTML/CSS design and Java code to be placed in the same file.
- A JSP page is compiled into a servlet, so it can take advantage of servlet features like platform independence and database-driven applications.
- JSP pages use tags like <jsp:include> and <jsp:useBean> to include content and access JavaBeans. Scriptlets, expressions, declarations, and directives are also used.
- Implicit objects like request, response, out, and session are automatically available in JSP pages
This document describes a C program for a telephone directory. It includes 7 chapters that cover an introduction, problem definition, modules used, implementation details, results, conclusions and future scope, and references. The implementation chapter includes the full code for the telephone directory program. It allows the user to add, display, delete, and save contact entries. The program uses linked lists and functions for various operations like adding, deleting, displaying entries. Screenshots of sample outputs are provided in the results section. The conclusion discusses potential future enhancements like adding fingerprints or photos.
This document provides an overview of Java generics through examples. It begins with simple examples demonstrating how generics can be used to define container classes (BoxPrinter) and pair classes (Pair). It discusses benefits like type safety and avoiding duplication. Further examples show generics with classes, methods, and limitations like erasure. Wildcard types are introduced as a way to overcome some limitations. Key points covered include generic methods, wildcards, raw types and warnings, limitations of wildcards, and issues with readability of generic code.
This document discusses Java 8 concurrency abstractions including asynchronous result processing using CompletableFuture and optimistic locking using StampedLock. It provides an overview and comparison to previous concurrency APIs. The agenda includes exploring CompletableFuture features like asynchronous execution, chaining reactions, and exception handling. It also covers using StampedLock for optimistic reads, comparing it to the previous ReentrantReadWriteLock approach. Examples are shown for common use cases of these new concurrency APIs.
Let us explore Java 8 features and start using it in your day to day work. You will be surprised how Java has evolved to become so different yet easy & powerful. In this presentation, we discuss Java 8 Stream API.
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIGanesh Samarthyam
This presentation provides a comprehensive overview of modern programming in Java. It focuses only on Java 8 features: Lambdas, Streams and Date Time API. It also briefly covers refactoring legacy Java code to Java 8.
The document is a collection of quotes related to DevOps. It includes quotes about the differences between developers and operations teams, the importance of automation in systems development, celebrating deployment successes, and viewing DevOps as a continual process of improvement rather than a goal. The quotes provide insights around collaboration, automation, and culture in DevOps.
This document provides an overview of DevOps fundamentals and culture. It discusses the dual challenge today of embracing new complex digital architectures while keeping release cycles short. It asks questions about how long it takes for a developer's change to reach production and what processes are involved. DevOps is defined as a cross-functional community dedicated to rapidly building, evolving, and operating secure and resilient systems at scale through automation, Agile processes, Lean principles, and engineering practices like continuous integration/delivery. The goal is to improve metrics like lead time for changes, release frequency, time to restore service, and change fail rate. Adopting DevOps requires measuring outcomes, establishing trust, and continuously improving.
A brief history on hybrid applications and their transformation from then to now. an overview of cross platform mobile app development, giving examples of Xamarin and Ionic.
This document discusses best practices for object-oriented Java design. It recommends learning design principles from books, conferences, and by analyzing code to see what works and doesn't work. Specific principles covered include the single responsibility principle, open/closed principle, Liskov substitution principle, interface segregation principle, and dependency inversion principle. Techniques demonstrated include using creation methods instead of constructors, replacing conditional logic with strategies, encapsulating classes with factories, and encapsulating composites with builders. The goal is to create well-designed, loosely coupled code that is easier to change and maintain.
Chef is a tool that helps provision and manage servers and their configurations. It comprises of three main elements - a server, nodes, and workstations. The server manages cookbooks and policies and ensures nodes comply with policies. Nodes are the managed servers. Workstations are where code is created and changed. Chef uses resources like packages, services, files to describe a system's desired state and recipes to combine resources. It follows a test and repair model to ensure nodes match their desired state.
DevOps is a set of practices intended to reduce the time between committing a change to a system and deploying it to production while ensuring high quality. It focuses on bridging the gap between developers and operations teams. Key principles of DevOps include systems thinking, amplifying feedback loops, and a culture of continuous learning and experimentation. DevOps aims to achieve lightning fast delivery through practices like continuous integration, deployment pipelines, infrastructure automation, and deployment strategies like blue-green deployments and canary testing.
This document discusses advanced Java debugging using bytecode. It explains that bytecode is the low-level representation of Java programs that is executed by the Java Virtual Machine (JVM). It shows examples of decompiling Java source code to bytecode instructions and evaluating bytecode on a stack. Various bytecode visualization and debugging tools are demonstrated. Key topics like object-oriented aspects of bytecode and the ".class" file format are also covered at a high-level.
Awareness of design smells - indicators of common design problems - helps developers or software engineers understand mistakes made while designing and apply design principles for creating high-quality designs. This workshop provides insights gained from performing refactoring in real-world projects to improve refactoring and reduce the time and costs of managing software projects. The workshop also presents insightful anecdotes and case studies drawn from the trenches of real-world projects. By attending this workshop, you will know pragmatic techniques for refactoring design smells to manage technical debt and to create and maintain high-quality software in practice.
Contents overview:
* Why care about design principles, design quality, or design smells?
* Refactoring as the primary means for repaying technical debt
* Smells that violate abstraction, encapsulation, modularisation, or hierarchy
* Tools and techniques for refactoring
The document discusses various Java concurrency concepts including threads, locks, semaphores, and concurrent collections. It provides examples to illustrate thread synchronization issues like race conditions and deadlocks. It also demonstrates how to use various concurrency utilities from java.util.concurrent package like CountDownLatch, Exchanger, PriorityBlockingQueue to synchronize thread execution and communication between threads. The examples aim to help developers write correct concurrent programs by avoiding common pitfalls in multithreaded programming.
Solid Principles Of Design (Design Series 01)Heartin Jacob
Learn about the solid principles of design along with some additional useful principles and practices and also few important considerations to avoid in your design. Introduction is also provided to the Design Patterns. This is usually taken as a hands on session with design and refactoring exercises.
The document discusses techniques for achieving zero downtime releases through continuous delivery and DevOps. It describes common pain points of traditional release processes and provides an overview of strategies like expand/contract deployments, blue-green deployments, canary releasing, cluster immune systems, feature toggles, and dark launching that allow applications to be updated with minimal disruption. These techniques aim to reduce risk and enable applications to be updated seamlessly and continuously.
Tool chain to produce high performance DevOps. It covers whole lifecycle of Softwares, includes Continuous Integration, Deployment, Delivery, Monitoring, Feedback/Improvement
The document describes a DevOps game called the Marshmallow Challenge where teams compete to build the tallest freestanding structure using spaghetti that can support a marshmallow on top. The game aims to teach DevOps principles like collaboration, continuous learning, and applying feedback. It discusses how different groups like kindergarten students versus business students or engineers perform. The rules and process for playing the game are provided along with learnings around integrating development, operations, testing and more.
Productive Programming in Java 8 - with Lambdas and Streams Ganesh Samarthyam
The document provides an overview of lambda expressions and functional interfaces in Java 8. It discusses key concepts like lambda functions, built-in functional interfaces like Predicate and Consumer, and how they can be used with streams. Examples are provided to demonstrate using lambdas with built-in interfaces like Predicate to filter a stream and Consumer to forEach over a stream. The document aims to help readers get hands-on experience coding with lambdas and streams in Java 8.
Book Preview: Oracle Certified Professional Java (OCP Java) SE 8 Programmer E...Hari kiran G
This is preview of our book. This book is a comprehensive, step-by-step and one-stop guide for cracking the Java SE 8 Programmer II exam (IZ0-809)
What are salient features of this Oracle Certified Professional Java SE 8 Programmer book?
- Our book starts by answering frequently asked questions about the exam preparation and taking the exam
- The book maps each exam topic into a chapter and covers 100% of the exam topics
- Gives good understanding of the concepts as each chapter explains it with numerous real world examples and illustrative programming
- Quick summary that revises key concepts covered in the chapter from exam perspective
- You can take the full-length mock exam to ensure that you have enough practice before actually taking the exam
100% Accurate and Updated dumps available for 1Z0-804 Exam-Java SE 7 Programmer II get 20% off on all dumps visit@https://www.troytec.com/1Z0-804-exams.html
The document contains 13 multiple choice questions related to threads in Java. The questions cover topics such as defining and starting threads, thread priorities, synchronized methods, and thread execution order.
This document provides 10 questions and answers related to the Sun Certified Programmer for the Java 2 Platform.SE 6.0 exam (310-065). The questions cover topics such as threads, exceptions, enums, inheritance, polymorphism and serialization. For each question there are multiple choice answers, with 1 or more answers being correctly marked.
The aptitude test consisted tricky questions on core subjects of CSE like C , C++, Java ,Data Structures, Database, Computer Networks, Theory of Computation.
The document contains 20 multiple choice questions about Java programming concepts such as threads, assertions, references, operators, and more. For each question, the stem presents a code snippet, output, or statement and asks which answer choice is true. The explanations provided give detailed reasoning for the correct answers and why the incorrect choices are wrong based on Java specifications.
Indus Valley Partner aptitude questions and answersSushant Choudhary
This document contains several code snippets and questions about Java programming concepts like arrays, exceptions, interfaces, and access modifiers. The correct answers and explanations provided indicate that:
1) Option B is the only valid way to declare and initialize an array with multiple elements in one statement.
2) Interface methods can only use the public access modifier and cannot be static, final, private, protected, transient, volatile, or synchronized.
3) The default values for array elements of primitive types are 0 for int, 0.0f for float, and null for reference types like String. For non-primitive types like Dog, the default is also null.
This document contains 20 multiple choice questions about Java programming concepts such as classes, constructors, exceptions, arrays, inheritance, and more. The questions cover topics like output of code snippets, default values of array elements, reserved keywords, valid code constructs, and true/false statements about classes, wrappers, and exceptions.
Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful BugsRafael Chinelato Del Nero
Bugs are a daily cause of stress in our work as Java developers. Those pesky things can hide behind core concepts in Java 9 and 10—there is no way out of this. If we don’t keep up to date with new Java versions, bugs will take over our projects. But can we have fun hunting them? You bet! How about solving a series of Java puzzles as a way to master concepts and save a lot of time finding those tricky bugs? In this session, attendees can help the bug hunters solve fun Java challenges, gain a clear understanding of what causes the most-stressful bugs—and have fun eliminating them from projects.
1. An interface is a blueprint of a class that defines abstract methods but does not provide method implementations. Interfaces are used to achieve abstraction and multiple inheritance in Java.
2. The properties of interfaces are that they can only contain abstract methods and static final fields, cannot be instantiated, and implemented classes must implement all interface methods.
3. A sample program demonstrates defining a Drawable interface with a draw() method and implementing class Rectangle that provides the draw() method implementation.
This document contains questions and answers about packages, interfaces, classes, exceptions, threads, and strings in Java. Some key points addressed are:
- Packages are used to organize related classes and avoid name conflicts. Interfaces define methods but not implementations, and are used for abstraction and multiple inheritance.
- There are three thread states: ready, running, and waiting. wait() releases the lock to allow other threads to run while sleep() does not.
- Exceptions can be checked, which must be declared or caught, or unchecked, which extend RuntimeException. Custom exceptions are created by extending the Exception class.
- Strings are immutable in Java but StringBuffer and StringBuilder provide mutable string alternatives.
The document discusses various aspects of exception handling in Java. It begins by defining the difference between 'throw' and 'throws', and their applications. It then discusses the difference between Exceptions and Errors, defines resource leaks, and describes the purpose and behavior of the 'finally' block. It provides answers to questions around try/catch blocks, exception objects, and defining multiple exceptions in the 'throws' clause.
Multiple Choice Questions for Java interfaces and exception handlingAbishek Purushothaman
The document contains 20 multiple choice questions about Java exceptions and interfaces. Regarding exceptions, questions cover which exception is thrown for divide by zero, keywords used in exception handling like try, catch, finally, and throw, and how exceptions propagate. Interface questions cover access specifiers, implementing interfaces, default and static methods in interfaces, and multiple vs hierarchical inheritance with interfaces.
Tcs sample technical placement paper level iPooja Reddy
This document provides a sample programming placement paper for TCS Level-I. It contains 36 multiple choice questions related to programming concepts in C, C++, Java and .NET. It also provides information on how to get free job updates and placement papers by visiting www.latestoffcampus.com or joining relevant Facebook and Google groups.
Threads allow programs to perform multiple tasks concurrently. A thread is a single sequence of execution within a program. Multithreading refers to multiple threads running within a single program. Threads share program resources but have their own call stack and local variables. Threads are created by extending the Thread class or implementing the Runnable interface. Synchronization is needed when multiple threads access shared resources concurrently to prevent race conditions. The wait() and notify() methods enable threads to cooperate by pausing and resuming execution.
Does Java Have a Future After Version 8? (Belfast JUG April 2014)Garth Gilmour
Presented to the Belfast Java User Group in April 2014 this talk explores if the changes made to Java in version 8 are enough to keep it the dominant programming platform.
The document contains a Java quiz with 22 multiple choice questions covering topics such as Java language fundamentals, OOP concepts like inheritance and polymorphism, exceptions, threads, JDBC, and regular expressions. The questions have a single correct answer choice for each.
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Udayan Khattry
Assess your preparation with these Practice Test Questions with Explanation. Questions are Extracted from Highest Rated Course on Udemy which has helped a lot of students to pass the exam with good score.
500+ multiple choice questions with explanation to assess Oracle Certified Associate, Java SE 8 Programmer II preparation.
Highest Rated course on UDEMY
Read the students success stories at:
https://udayankhattry.com/ocp/
Enroll now to receive maximum discount on the course ie. for just $9.99 or ₹640.00, click the link below- https://www.udemy.com/java-ocp/?couponCode=UDAYANKHATTRY.COM
To avail maximum discount on all courses visit: www.udayankhattry.com
The document contains multiple choice questions about Java programming concepts. It asks the reader to identify code snippets that can be used to access a class variable, the number of String objects created in a given code example, and which statements are true about the finalize method.
The document contains 11 multiple choice questions and 11 short answer questions about Java programming concepts. The multiple choice questions cover topics like abstract classes, data structures, object visibility, exceptions, EJBs, and Java features. The short answer questions ask about differences between J2EE and J2SE, design patterns, interfaces, reflection, local and remote interfaces, final constructors, equals() vs ==, finalize(), static variables, caching across a cluster, and bug prevention techniques.
This document discusses using event-driven architectures and serverless computing with AWS services. It begins with defining event-driven architectures and how serverless architectures relate to them. It then outlines several AWS services like EventBridge, Step Functions, SQS, SNS, and Lambda that are well-suited for building event-driven applications. The document demonstrates using S3, DynamoDB, API Gateway and other services to build a serverless hotel data ingestion and shopping platform that scales independently for static and dynamic data. It shows how to upload, store, and stream hotel data and expose APIs using serverless AWS services in an event-driven manner.
This document provides an overview of the Azure Batch Service, including its core features, architecture, and monitoring capabilities. It discusses how Azure Batch allows uploading batch jobs to the cloud to be executed and managed, covering concepts like job scheduling, resource management, and process monitoring. The document also demonstrates Azure Batch usage through the Azure portal and Batch Explorer tool and reviews quotas and limits for Batch accounts, pools, jobs, and other resources.
In this session, we will take a deep-dive into the DevOps process that comes with Azure Machine Learning service, a cloud service that you can use to track as you build, train, deploy and manage models. We zoom into how the data science process can be made traceable and deploy the model with Azure DevOps to a Kubernetes cluster.
At the end of this session, you will have a good grasp of the technological building blocks of Azure machine learning services and can bring a machine learning project safely into production.
When it comes to microservice architecture, sometimes all you wanted is to perform cross cutting concerns ( logging, authentication , caching, CORS, Routing, load balancing , exception handling , tracing, resiliency etc..) and also there might be a scenario where you wanted to perform certain manipulations on your request payload before hitting into your actual handler. And this should not be a repetitive code in each of the services , so all you might need is a single place to orchestrate all these concerns and that is where Middleware comes into the picture. In the demo I will be covering how to orchestrate these cross cutting concerns by using Azure functions as a Serverless model.
In this talk, we will start with some introduction to Azure Functions, its triggers and bindings. Later we will build a serverless solution to solve a problem statement by using different triggers and bindings of Azure Functions.
Language to be used: C# and IDE - Visual Studio 2019 Community Edition"
In this workshop, you will understand how Azure DevOps Services helps you scale DevOps adoption strategies in enterprise. We will explore various feature and services that can enable you to implement various DevOps practices starting from planning, version control, CI & CD , Dependency Management and Test planning.
In this session, we will understand how to create your first pipeline and build an environment to restore dependencies and how to run tests in Azure DevOps followed by building an image and pushing it to container registry.
In this session, we will discuss a use case where we need to quickly develop web and mobile front end applications which are using several different frameworks, hosting options, and complex integrations between systems under the hood. Let’s see how we can leverage serverless technologies (Azure Functions and logic apps) and Low Code/No code platform to achieve the goal. During the session we will go though the code followed by a demonstration.
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...CodeOps Technologies LLP
In this talk people will get to know how we can use change feed feature of Cosmos DB and use azure functions and signal or service to develop a real time dashboard system
Imagine a scenario, where you can launch a video call or chat with an advisor, agent, or clinician in just one-click. We will explore application patterns that will enable you to write event-driven, resilient and highly scalable applications with Functions that too with power of engaging communication experience at scale. During the session, we will go through the use case along with code walkthrough and demonstration.
We will walk through the exploration, training and serving of a machine learning model by leveraging Kubeflow's main components. We will use Jupyter notebooks on the cluster to train the model and then introduce Kubeflow Pipelines to chain all the steps together, to automate the entire process.
It is difficult to deploy interloop Kubernetes development in current state. Know these open-source projects that can save us from the burden of various tools and help in deploying microservices on Kubernetes cluster without saving secrets in a file.
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...CodeOps Technologies LLP
Running day-1 Ops on your Kubernetes is somewhat easy, but it is quite daunting to manage day two challenges. Learn about AKS best practices for your cloud-native applications so that you can avoid blow up your workloads.
Prometheus is a popular open source metric monitoring solution and Azure Monitor provides a seamless onboarding experience to collect Prometheus metrics. Learn how to configure scraping of Prometheus metrics with Azure Monitor for containers running in AKS cluster.
What if you could combine Trello, GitLab, JIRA, Calendar, Slack, Confluence, and more - all together into one solution?
Yes, we are talking about Space - the latest tool from JetBrains famous for its developer productivity-enhancing tools (esp. IntelliJ IDEA).
Here we have explained about JetBrains' space and its functionalities.
This document provides an overview of functional programming concepts in Java 8 including lambdas and streams. It introduces lambda functions as anonymous functions without a name. Lambdas allow internal iteration over collections using forEach instead of external iteration with for loops. Method references provide a shorthand for lambda functions by "routing" function parameters. Streams in Java 8 enhance the library and allow processing data pipelines in a functional way.
This talk will serve as a practical introduction to Distributed Tracing. We will see how we can make best use of open source distributed tracing platforms like Hypertrace with Azure and find the root cause of problems and predict issues in our critical business applications beforehand.
This talk serves as a practical introduction to Distributed Tracing. We will see how we can make best use of open source distributed tracing platforms like Hypertrace with Azure and find the root cause of problems and predict issues in our critical business applications beforehand.
Presentation part of Open Source Days on 30 Oct - ossdays.konfhub.com
Providing an OGC API Processes REST Interface for FME FlowSafe Software
This presentation will showcase an adapter for FME Flow that provides REST endpoints for FME Workspaces following the OGC API Processes specification. The implementation delivers robust, user-friendly API endpoints, including standardized methods for parameter provision. Additionally, it enhances security and user management by supporting OAuth2 authentication. Join us to discover how these advancements can elevate your enterprise integration workflows and ensure seamless, secure interactions with FME Flow.
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc
How does your privacy program compare to your peers? What challenges are privacy teams tackling and prioritizing in 2025?
In the sixth annual Global Privacy Benchmarks Survey, we asked global privacy professionals and business executives to share their perspectives on privacy inside and outside their organizations. The annual report provides a 360-degree view of various industries' priorities, attitudes, and trends. See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar features an expert panel discussion and data-driven insights to help you navigate the shifting privacy landscape. Whether you are a privacy officer, legal professional, compliance specialist, or security expert, this session will provide actionable takeaways to strengthen your privacy strategy.
This webinar will review:
- The emerging trends in data protection, compliance, and risk
- The top challenges for privacy leaders, practitioners, and organizations in 2025
- The impact of evolving regulations and the crossroads with new technology, like AI
Predictions for the future of privacy in 2025 and beyond
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfAlkin Tezuysal
As the demand for vector databases and Generative AI continues to rise, integrating vector storage and search capabilities into traditional databases has become increasingly important. This session introduces the *MyVector Plugin*, a project that brings native vector storage and similarity search to MySQL. Unlike PostgreSQL, which offers interfaces for adding new data types and index methods, MySQL lacks such extensibility. However, by utilizing MySQL's server component plugin and UDF, the *MyVector Plugin* successfully adds a fully functional vector search feature within the existing MySQL + InnoDB infrastructure, eliminating the need for a separate vector database. The session explains the technical aspects of integrating vector support into MySQL, the challenges posed by its architecture, and real-world use cases that showcase the advantages of combining vector search with MySQL's robust features. Attendees will leave with practical insights on how to add vector search capabilities to their MySQL systems.
Developing Schemas with FME and Excel - Peak of Data & AI 2025Safe Software
When working with other team members who may not know the Esri GIS platform or may not be database professionals; discussing schema development or changes can be difficult. I have been using Excel to help illustrate and discuss schema design/changes during meetings and it has proven a useful tool to help illustrate how a schema will be built. With just a few extra columns, that Excel file can be sent to FME to create new feature classes/tables. This presentation will go thru the steps needed to accomplish this task and provide some lessons learned and tips/tricks that I use to speed the process.
Interested in leveling up your JavaScript skills? Join us for our Introduction to TypeScript workshop.
Learn how TypeScript can improve your code with dynamic typing, better tooling, and cleaner architecture. Whether you're a beginner or have some experience with JavaScript, this session will give you a solid foundation in TypeScript and how to integrate it into your projects.
Workshop content:
- What is TypeScript?
- What is the problem with JavaScript?
- Why TypeScript is the solution
- Coding demo
Kubernetes Security Act Now Before It’s Too LateMichael Furman
In today's cloud-native landscape, Kubernetes has become the de facto standard for orchestrating containerized applications, but its inherent complexity introduces unique security challenges. Are you one YAML away from disaster?
This presentation, "Kubernetes Security: Act Now Before It’s Too Late," is your essential guide to understanding and mitigating the critical security risks within your Kubernetes environments. This presentation dives deep into the OWASP Kubernetes Top Ten, providing actionable insights to harden your clusters.
We will cover:
The fundamental architecture of Kubernetes and why its security is paramount.
In-depth strategies for protecting your Kubernetes Control Plane, including kube-apiserver and etcd.
Crucial best practices for securing your workloads and nodes, covering topics like privileged containers, root filesystem security, and the essential role of Pod Security Admission.
Don't wait for a breach. Learn how to identify, prevent, and respond to Kubernetes security threats effectively.
It's time to act now before it's too late!
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfRejig Digital
Unlock the future of oil & gas safety with advanced environmental detection technologies that transform hazard monitoring and risk management. This presentation explores cutting-edge innovations that enhance workplace safety, protect critical assets, and ensure regulatory compliance in high-risk environments.
🔍 What You’ll Learn:
✅ How advanced sensors detect environmental threats in real-time for proactive hazard prevention
🔧 Integration of IoT and AI to enable rapid response and minimize incident impact
📡 Enhancing workforce protection through continuous monitoring and data-driven safety protocols
💡 Case studies highlighting successful deployment of environmental detection systems in oil & gas operations
Ideal for safety managers, operations leaders, and technology innovators in the oil & gas industry, this presentation offers practical insights and strategies to revolutionize safety standards and boost operational resilience.
👉 Learn more: https://www.rejigdigital.com/blog/continuous-monitoring-prevent-blowouts-well-control-issues/
If You Use Databricks, You Definitely Need FMESafe Software
DataBricks makes it easy to use Apache Spark. It provides a platform with the potential to analyze and process huge volumes of data. Sounds awesome. The sales brochure reads as if it is a can-do-all data integration platform. Does it replace our beloved FME platform or does it provide opportunities for FME to shine? Challenge accepted
Enabling BIM / GIS integrations with Other Systems with FMESafe Software
Jacobs has successfully utilized FME to tackle the complexities of integrating diverse data sources in a confidential $1 billion campus improvement project. The project aimed to create a comprehensive digital twin by merging Building Information Modeling (BIM) data, Construction Operations Building Information Exchange (COBie) data, and various other data sources into a unified Geographic Information System (GIS) platform. The challenge lay in the disparate nature of these data sources, which were siloed and incompatible with each other, hindering efficient data management and decision-making processes.
To address this, Jacobs leveraged FME to automate the extraction, transformation, and loading (ETL) of data between ArcGIS Indoors and IBM Maximo. This process ensured accurate transfer of maintainable asset and work order data, creating a comprehensive 2D and 3D representation of the campus for Facility Management. FME's server capabilities enabled real-time updates and synchronization between ArcGIS Indoors and Maximo, facilitating automatic updates of asset information and work orders. Additionally, Survey123 forms allowed field personnel to capture and submit data directly from their mobile devices, triggering FME workflows via webhooks for real-time data updates. This seamless integration has significantly enhanced data management, improved decision-making processes, and ensured data consistency across the project lifecycle.
Your startup on AWS - How to architect and maintain a Lean and Mean account J...angelo60207
Prevent infrastructure costs from becoming a significant line item on your startup’s budget! Serial entrepreneur and software architect Angelo Mandato will share his experience with AWS Activate (startup credits from AWS) and knowledge on how to architect a lean and mean AWS account ideal for budget minded and bootstrapped startups. In this session you will learn how to manage a production ready AWS account capable of scaling as your startup grows for less than $100/month before credits. We will discuss AWS Budgets, Cost Explorer, architect priorities, and the importance of having flexible, optimized Infrastructure as Code. We will wrap everything up discussing opportunities where to save with AWS services such as S3, EC2, Load Balancers, Lambda Functions, RDS, and many others.
➡ 🌍📱👉COPY & PASTE LINK👉👉👉 ➤ ➤➤ https://drfiles.net/
Wondershare Filmora Crack is a user-friendly video editing software designed for both beginners and experienced users.
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfällepanagenda
Webinar Recording: https://www.panagenda.com/webinars/domino-iq-was-sie-erwartet-erste-schritte-und-anwendungsfalle/
HCL Domino iQ Server – Vom Ideenportal zur implementierten Funktion. Entdecken Sie, was es ist, was es nicht ist, und erkunden Sie die Chancen und Herausforderungen, die es bietet.
Wichtige Erkenntnisse
- Was sind Large Language Models (LLMs) und wie stehen sie im Zusammenhang mit Domino iQ
- Wesentliche Voraussetzungen für die Bereitstellung des Domino iQ Servers
- Schritt-für-Schritt-Anleitung zur Einrichtung Ihres Domino iQ Servers
- Teilen und diskutieren Sie Gedanken und Ideen, um das Potenzial von Domino iQ zu maximieren
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMAnchore
Over 70% of any given software application consumes open source software (most likely not even from the original source) and only 15% of organizations feel confident in their risk management practices.
With the newly announced Anchore SBOM feature, teams can start safely consuming OSS while mitigating security and compliance risks. Learn how to import SBOMs in industry-standard formats (SPDX, CycloneDX, Syft), validate their integrity, and proactively address vulnerabilities within your software ecosystem.
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Safe Software
Jacobs has developed a 3D utility solids modelling workflow to improve the integration of utility data into 3D Building Information Modeling (BIM) environments. This workflow, a collaborative effort between the New Zealand Geospatial Team and the Australian Data Capture Team, employs FME to convert 2D utility data into detailed 3D representations, supporting enhanced spatial analysis and clash detection.
To enable the automation of this process, Jacobs has also developed a survey data standard that standardizes the capture of existing utilities. This standard ensures consistency in data collection, forming the foundation for the subsequent automated validation and modelling steps. The workflow begins with the acquisition of utility survey data, including attributes such as location, depth, diameter, and material of utility assets like pipes and manholes. This data is validated through a custom-built tool that ensures completeness and logical consistency, including checks for proper connectivity between network components. Following validation, the data is processed using an automated modelling tool to generate 3D solids from 2D geometric representations. These solids are then integrated into BIM models to facilitate compatibility with 3D workflows and enable detailed spatial analyses.
The workflow contributes to improved spatial understanding by visualizing the relationships between utilities and other infrastructure elements. The automation of validation and modeling processes ensures consistent and accurate outputs, minimizing errors and increasing workflow efficiency.
This methodology highlights the application of FME in addressing challenges associated with geospatial data transformation and demonstrates its utility in enhancing data integration within BIM frameworks. By enabling accurate 3D representation of utility networks, the workflow supports improved design collaboration and decision-making in complex infrastructure projects
Domino IQ – What to Expect, First Steps and Use Casespanagenda
Webinar Recording: https://www.panagenda.com/webinars/domino-iq-what-to-expect-first-steps-and-use-cases/
HCL Domino iQ Server – From Ideas Portal to implemented Feature. Discover what it is, what it isn’t, and explore the opportunities and challenges it presents.
Key Takeaways
- What are Large Language Models (LLMs) and how do they relate to Domino iQ
- Essential prerequisites for deploying Domino iQ Server
- Step-by-step instructions on setting up your Domino iQ Server
- Share and discuss thoughts and ideas to maximize the potential of Domino iQ
2. Question
You’ve written an application for processing tasks. In this application,
you’ve separated the critical or urgent tasks from the ones that are not
critical or urgent. You’ve assigned high priority to critical or urgent tasks.
In this application, you find that the tasks that are not critical or urgent
are the ones that keep waiting for an unusually long time. Since critical or
urgent tasks are high priority, they run most of the time. Which one of
the following multi-threading problems correctly describes this situation?
A. Deadlock
B. Starvation
C. Livelock
D. Race condition
3. Answer
You’ve written an application for processing tasks. In this application,
you’ve separated the critical or urgent tasks from the ones that are not
critical or urgent. You’ve assigned high priority to critical or urgent tasks.
In this application, you find that the tasks that are not critical or urgent are
the ones that keep waiting for an unusually long time. Since critical or
urgent tasks are high priority, they run most of the time. Which one of the
following multi-threading problems correctly describes this situation?
A. Deadlock
B. Starvation
C. Livelock
D. Race condition
4. Explanation
B . Starvation
The situation in which low-priority threads keep waiting
for a long time to acquire the lock and execute the code
in critical sections is known as starvation.
Starvation
Starvation describes a situation where a thread is unable to gain regular access to shared
resources and is unable to make progress. This happens when shared resources are made
unavailable for long periods by "greedy" threads.
Livelock
A thread often acts in response to the action of another thread. If the other thread's
action is also a response to the action of another thread, then livelock may result. As with
deadlock, livelocked threads are unable to make further progress. However, the threads
are not blocked — they are simply too busy responding to each other to resume work.
This is comparable to two people attempting to pass each other in a corridor: Alphonse
moves to his left to let Gaston pass, while Gaston moves to his right to let Alphonse pass.
Seeing that they are still blocking each other, Alphone moves to his right, while Gaston
moves to his left. They're still blocking each other, so...
Source: docs.oracle.com
5. Question
Which of the following two definitions of Sync (when
compiled in separate files) will compile without errors?
A. class Sync {
public synchronized void foo() {}
}
B. abstract class Sync {
public synchronized void foo() {}
}
C. abstract class Sync {
public abstract synchronized void foo();
}
D. interface Sync {
public synchronized void foo();
}
6. Answer
Which of the following two definitions of Sync (when
compiled in separate files) will compile without errors?
A. class Sync {
public synchronized void foo() {}
}
B. abstract class Sync {
public synchronized void foo() {}
}
C. abstract class Sync {
public abstract synchronized void foo();
}
D. interface Sync {
public synchronized void foo();
}
7. Explanation
Abstract methods (in abstract classes or interfaces)
cannot be declared synchronized , hence the options C
and D are incorrect.
8. Question
Which one of the following options correctly makes use of
Callable that will compile without any errors?
A. import java.util.concurrent.Callable;
class CallableTask implements Callable {
public int call() {
System.out.println("In Callable.call()");
return 0;
}
}
B. import java.util.concurrent.Callable;
class CallableTask extends Callable {
public Integer call() {
System.out.println("In Callable.call()");
return 0;
}
}
C. import java.util.concurrent.Callable;
class CallableTask implements
Callable<Integer> {
public Integer call() {
System.out.println("In Callable.call()");
return 0;
}
}
D. import java.util.concurrent.Callable;
class CallableTask implements
Callable<Integer> {
public void call(Integer i) {
System.out.println("In Callable.call(i)");
}
}
9. Answer
Which one of the following options correctly makes use of
Callable that will compile without any errors?
A. import java.util.concurrent.Callable;
class CallableTask implements Callable {
public int call() {
System.out.println("In Callable.call()");
return 0;
}
}
B. import java.util.concurrent.Callable;
class CallableTask extends Callable {
public Integer call() {
System.out.println("In Callable.call()");
return 0;
}
}
C. import java.util.concurrent.Callable;
class CallableTask implements
Callable<Integer> {
public Integer call() {
System.out.println("In Callable.call()");
return 0;
}
}
D. import java.util.concurrent.Callable;
class CallableTask implements
Callable<Integer> {
public void call(Integer i) {
System.out.println("In Callable.call(i)");
}
}
10. Explanation
C. The Callable interface is defined as follows:
public interface Callable<V> {
V call() throws Exception;
}
In option A), the call() method has the return type int , which
is incompatible with the return type expected for overriding
the call method and so will not compile.
In option B), the extends keyword is used, which will result in
a compiler (since Callable is an interface, the implements
keyword should be used).
In option D), the return type of call() is void and the call()
method also takes a parameter of type Integer . Hence, the
method declared in the interface Integer call() remains
unimplemented in the CallableTask class, so the program will
not compile.
11. Question
Here is a class named PingPong that extends the Thread class. Which of the
following PingPong class implementations correctly prints “ping” from the
worker thread and then prints “pong” from the main thread?
A. public static void main(String []args) {
Thread pingPong = new PingPong();
System.out.print("pong");
}
}
B. public static void main(String []args) {
Thread pingPong = new PingPong();
pingPong.run();
System.out.print("pong");
}}
C. public static void main(String []args) {
Thread pingPong = new PingPong();
pingPong.start();
System.out.println("pong");
}}
D. public static void main(String []args)
throws InterruptedException{
Thread pingPong = new PingPong();
pingPong.start();
pingPong.join();
System.out.println("pong");
}}
class PingPong extends Thread {
public void run() {
System.out.println("ping ");
}
12. Answer
Here is a class named PingPong that extends the Thread class. Which of the
following PingPong class implementations correctly prints “ping” from the
worker thread and then prints “pong” from the main thread?
A. public static void main(String []args) {
Thread pingPong = new PingPong();
System.out.print("pong");
}
}
B. public static void main(String []args) {
Thread pingPong = new PingPong();
pingPong.run();
System.out.print("pong");
}}
C. public static void main(String []args) {
Thread pingPong = new PingPong();
pingPong.start();
System.out.println("pong");
}}
D. public static void main(String []args)
throws InterruptedException{
Thread pingPong = new PingPong();
pingPong.start();
pingPong.join();
System.out.println("pong");
}}
class PingPong extends Thread {
public void run() {
System.out.println("ping ");
}
13. Explanation
D .
The main thread creates the worker thread and waits for it to
complete (which prints “ping”). After that it prints “pong”. So,
this implementation correctly prints “ping pong”.
Why are the other options wrong?
A. The main() method creates the worker thread, but doesn’t start it.
So, the code given in this option only prints “pong”.
B. The program always prints “ping pong”, but it is misleading. The
code in this option directly calls the run() method instead of calling
the start() method. So, this is a single threaded program: both “ping”
and “pong” are printed from the main thread.
C. The main thread and the worker thread execute independently
without any coordination. (Note that it does not have a call to join()
in the main method.) So, depending on which thread is scheduled
first, you can get “ping pong” or “pong ping” printed.
14. Question
Choose the correct option based on this program:
class COWArrayListTest {
public static void main(String []args) {
ArrayList<Integer> aList =
new CopyOnWriteArrayList<Integer>(); // LINE A
aList.addAll(Arrays.asList(10, 20, 30, 40));
System.out.println(aList);
}
}
A. When executed the program prints the following: [10, 20, 30, 40].
B. When executed the program prints the following:
CopyOnWriteArrayList.class .
C. The program does not compile and results in a compiler error in line
marked with comment LINE A .
D. When executed the program throws a runtime exception
ConcurrentModificationException .
15. Answer
Choose the correct option based on this program:
class COWArrayListTest {
public static void main(String []args) {
ArrayList<Integer> aList =
new CopyOnWriteArrayList<Integer>(); // LINE A
aList.addAll(Arrays.asList(10, 20, 30, 40));
System.out.println(aList);
}
}
A. When executed the program prints the following: [10, 20, 30, 40].
B. When executed the program prints the following:
CopyOnWriteArrayList.class .
C. The program does not compile and results in a compiler error in line
marked with comment LINE A .
D. When executed the program throws a runtime exception
ConcurrentModificationException .
16. Explanation
C . The program does not compile and results in a
compiler error in the line marked with comment LINE
A.
The class CopyOnWriteArrayList does not inherit from
ArrayList , so an attempt to assign a
CopyOnWriteArrayList to an ArrayList reference will
result in a compiler error. Note that the ArrayList
suffix in the class named CopyOnWriteArrayList could
be misleading as these two classes do not share anIS-
A relationship.
17. Question
What will this code segment print?
public static void main(String []args) {
List<Integer> ints = Arrays.asList(1, 2, 3, 4, 5);
System.out.println(ints.parallelStream()
.filter(i -> (i % 2) == 0).sequential()
.isParallel());
}
A. Prints 2 4
B. Prints false
C. Prints true
D. Cannot predict output
18. Answer
What will this code segment print?
public static void main(String []args) {
List<Integer> ints = Arrays.asList(1, 2, 3, 4, 5);
System.out.println(ints.parallelStream()
.filter(i -> (i % 2) == 0).sequential()
.isParallel());
}
A. Prints 2 4
B. Prints false
C. Prints true
D. Cannot predict output
19. Explanation
B. Prints false
Though the created stream is a parallel stream, the
call to the sequential() method has made the stream
sequential. Hence, the call isParallel() prints false .
20. Question
Which one of the following methods return a Future object?
A. The overloaded replace() methods declared in the ConcurrentMap
interface
B. The newThread() method declared in the ThreadFactory interface
C. The overloaded submit() methods declared in the ExecutorService
interface
D. The call() method declared in the Callable interface
21. Answer
Which one of the following methods return a Future object?
A. The overloaded replace() methods declared in the ConcurrentMap
interface
B. The newThread() method declared in the ThreadFactory interface
C. The overloaded submit() methods declared in the ExecutorService
interface
D. The call() method declared in the Callable interface
22. Explanation
C . The overloaded submit() methods declared in
ExecutorService interface. The ExecutorService interface
extends the Executor interface and provides services such as
termination of threads and production of Future objects. Some
tasks may take considerable execution time
to complete. So, when you submit a task to the executor
service, you get a Future object.
A. The overloaded replace() methods declared in the ConcurrentMap
interface remove an element from the map and return the success
status (a Boolean value) or the removed value.
B. The new Thread() is the only method declared in the
ThreadFactory interface and it returns a Thread object as the return
value
D. The call() method declared in Callable interface returns the result
of the task it executed.
23. Question
In your application, there is a producer component that keeps adding
new items to a fixed-size queue; the consumer component fetches
items from that queue. If the queue is full, the producer has to wait
for items to be fetched; if the queue is empty, the consumer has to
wait for items to be added.
Which one of the following utilities is suitable for synchronizing the
common queue for concurrent use by a producer and consumer?
A. ForkJoinPool
B. Future
C. Semaphore
D. TimeUnit
24. Answer
In your application, there is a producer component that keeps adding
new items to a fixed-size queue; the consumer component fetches
items from that queue. If the queue is full, the producer has to wait for
items to be fetched; if the queue is empty, the consumer has to wait
for items to be added.
Which one of the following utilities is suitable for synchronizing the
common queue for concurrent use by a producer and consumer?
A. ForkJoinPool
B. Future
C. Semaphore
D. TimeUnit
25. Explanation
C. Semaphore
The question is a classic producer–consumer problem that can be
solved by using semaphores. The objects of the synchronizer class
java.util.concurrent.Semaphore can be used to guard the common
queue so that the producer and consumer can synchronize their
access to the queue. Of the given options, semaphore is the only
synchronizer ; other options are unrelated to providing
synchronized access to a queue.
A. ForkJoinPool provides help in running a ForkJoinTask in the context of
the Fork/Join framework.
B. Future represents the result of an asynchronous computation whose
result will be “available in the future once the computation is complete.”
D. TimeUnit is an enumeration that provides support for different time
units such as milliseconds, seconds, and days.
26. Question
What will this code segment print?
class StringConcatenator {
public static String result = "";
public static void concatStr(String str) {
result = result + " " + str;
}
}
class StringSplitAndConcatenate {
public static void main(String []args) {
String words[] = "the quick brown fox jumps over the lazy dog".split(" ");
Arrays.stream(words).parallel().forEach(StringConcatenator::concatStr);
System.out.println(StringConcatenator.result);
}
}
A. over jumps lazy dog the brown fox quick the
B. the quick brown fox jumps over the lazy dog
C. Prints each word in new line
D. Cannot predict output
27. Answer
What will this code segment print?
class StringConcatenator {
public static String result = "";
public static void concatStr(String str) {
result = result + " " + str;
}
}
class StringSplitAndConcatenate {
public static void main(String []args) {
String words[] = "the quick brown fox jumps over the lazy dog".split(" ");
Arrays.stream(words).parallel().forEach(StringConcatenator::concatStr);
System.out.println(StringConcatenator.result);
}
}
A. over jumps lazy dog the brown fox quick the
B. the quick brown fox jumps over the lazy dog
C. Prints each word in new line
D. Cannot predict output
28. Explanation
D. Cannot predict output
When the stream is parallel, the task is split into
multiple sub-tasks and different threads execute it.
The calls to forEach(StringConcatenator::concatStr)
now access the globally accessible variable result
in StringConcatenator class. Hence it results in garbled
output.
29. Question
What is the expected output of this program when invoked as follows:
java -ea AtomicIntegerTest
static AtomicInteger ai = new AtomicInteger(10);
public static void main(String []args) {
ai.incrementAndGet();
ai.getAndDecrement();
ai.compareAndSet(10, 11);
assert (ai.intValue() % 2) == 0;
System.out.println(ai);
}
A. Prints 10 11
B. Prints 10
C. It crashes throwing an AssertionError
D. Prints 9
30. Answer
What is the expected output of this program when invoked as follows:
java -ea AtomicIntegerTest
static AtomicInteger ai = new AtomicInteger(10);
public static void main(String []args) {
ai.incrementAndGet();
ai.getAndDecrement();
ai.compareAndSet(10, 11);
assert (ai.intValue() % 2) == 0;
System.out.println(ai);
}
A. Prints 10 11
B. Prints 10
C. It crashes throwing an AssertionError
D. Prints 9
31. Explanation
C. It crashes throwing an AssertionError .
The initial value of AtomicInteger is 10. Its value is
incremented by 1 after calling incrementAndGet ().
After that, its value is decremented by 1 after calling
getAndDecrement ( ).
The method compareAndSet (10, 11) checks if the
current value is 10, and if so sets the atomic integer
variable to value 11.
Since the assert statement checks if the atomic
integer value % 2 is zero (that is, checks if it is an even
number), the assert fails and the program results in an
AssertionError .
32. Question
Consider that you are developing an cards game where a person starts the
game and waits for the other players to join. Minimum 4 players are
required to start the game and as soon as all the players are available the
game has to get started. For developing such kind of game application which
of the following synchronization technique would be ideal:
A. Semaphore
B. Exchanger
C. Runnable
D. Cyclic Barrier
33. Answer
Consider that you are developing an cards game where a person starts the
game and waits for the other players to join. Minimum 4 players are
required to start the game and as soon as all the players are available the
game has to get started. For developing such kind of game application which
of the following synchronization technique would be ideal:
A. Semaphore
B. Exchanger
C. Runnable
D. Cyclic Barrier
34. Explanation
D. CyclicBarrier
CyclicBarrier helps provide a synchronization point
where threads may need to wait at a predefined
execution point until all other threads reach that
point.
A. A Semaphore controls access to shared resources.
A semaphore maintains a counter to specify number
of resources that the semaphore controls
B. The Exchanger class is meant for exchanging data
between two threads. This class is useful when two
threads need to synchronize between each other and
continuously
exchange data.
C. Runnable is an interface used in creating threads
35. Question
Consider the following program and choose the correct option describing its
behavior
class PingPong extends Thread {
public void run() {
System.out.print("ping ");
throw new IllegalStateException();
}
public static void main(String []args) throws InterruptedException {
Thread pingPong = new PingPong();
pingPong.start();
System.out.print("pong");
}
}
A. This program results in a compiler error.
B. Prints the ping pong and exception in any order
C. This program throws a runtime error.
D. Prints pong ping
36. Answer
Consider the following program and choose the correct option describing its
behavior
class PingPong extends Thread {
public void run() {
System.out.print("ping ");
throw new IllegalStateException();
}
public static void main(String []args) throws InterruptedException {
Thread pingPong = new PingPong();
pingPong.start();
System.out.print("pong");
}
}
A. This program results in a compiler error.
B. Prints the ping pong and exception in any order
C. This program throws a runtime error.
D. Prints pong ping
37. Explanation
B. Prints the ping pong and exception in any order
The programs executes fine and the exact output
cannot be predicted as the main thread and the
worker thread execute independently without any
coordination.
38. Question
Consider the following program and choose the correct option describing its behavior
public static void main(String[] args) {
ExecutorService executor;
try(executor = Executors.newFixedThreadPool(5)){
Runnable worker = new Runnable() {
public void run() {
System.out.print("Hello");
} };
executor.execute(worker);
executor.shutdown();
System.out.println("Execution completed");
}
}
A. This program results in a compiler error.
B. Prints Execution completed and Hello in next line
C. Prints Hello
D. Prints Execution completed
39. Answer
Consider the following program and choose the correct option describing its behavior
public static void main(String[] args) {
ExecutorService executor;
try(executor = Executors.newFixedThreadPool(5)){
Runnable worker = new Runnable() {
public void run() {
System.out.print("Hello");
} };
executor.execute(worker);
executor.shutdown();
System.out.println("Execution completed");
}
}
A. This program results in a compiler error.
B. Prints Execution completed and Hello in next line
C. Prints Hello
D. Prints Execution completed
40. Explanation
A. This program results in a compiler error
Try-with-resources statement cannot be used here as,
ExecutorServices does not implement
java.lang.AutoCloseable interface
41. Upcoming Workshops/Bootcamps
• SOLID Principles and Design Patterns – Aug 27th
• Microsoft Azure Bootcamp – Aug 27th
• Modern Software Architecture – Sep 10th
Please visit CodeOps.tech for more details such as
agenda/cost/trainer and registration.
OCP Java: http://ocpjava.wordpress.com
42. Tech talks
Tech talks are for knowledge sharing - so there is no cost
associated with it
We usually share the presentation & supporting material to
the participants after the tech talk
Duration of the tech talk would be for 1 hour and will be
given at your office premises
Topics on which we offer tech talks can be found here Tech
Talk Topics
We also offer free workshop on Introduction to Docker
which will be a hands-on session
43. Meetups
• Core-Java-Meetup-Bangalore
• Software-Craftsmanship-Bangalore – 20th July @Ginserv
• Container-Developers-Meetup - 20th Aug @Avaya
• CloudOps-Meetup-Bangalore - 20th Aug @Avaya
• JavaScript-Meetup-Bangalore - 20th Aug
• Technical-Writers-Meetup-Bangalore – 25th Sep
• Software Architects Bangalore – 1st Oct @Prowareness
• Bangalore-SDN-IoT-NetworkVirtualization-Enthusiasts
44. Founders Achievements
www.codeops.tech slideshare.net/codeops
[email protected] linkedin.com/codeops
Has 14+ years of corporate experience and worked in
various roles and conducted many corporate trainings
Authored/co-authored many articles, research papers,
and books that got internationally published and
respected in the community
Have Software Engineering Certified Instructor (SECI)
and Professional Software Engineering Master (PSEM)
certifications from IEEE