Travaux pratiques (TP) - Programmation
91 documents à télécharger gratuitement
Travaux pratiques (TP) de programmation partagés par des étudiants et des enseignants. Thèmes couverts : algorithmique, langage C, Java, Python, POO, structures de données.
This document outlines a lab exercise focused on inter-process communication and synchronization using monitors. It includes various exercises that implement solutions to problems such as readers-writers and philosophers. The aim is to demonstrate the application of monitors and IPC in managing resource access among multiple processes.
This document outlines a lab exercise focused on multi-threading in the context of managing students in a classroom setting. It discusses the implementation of an algorithm for synchronizing multiple student threads with a teacher thread. The task is to complete a provided function related to student thread behavior.
This document presents the practical work conducted in a programming course using Java Remote Method Invocation (RMI). It includes various exercises demonstrating the implementation of remote interfaces, server-client communication, and error handling. The work was carried out by students Amani Ben Dhiab and Mohamed Yassine Chaieb under the guidance of Mme. Nadia Ben Azzouna during the 2012-2013 academic year.
This document provides an overview of various string manipulation methods available in JavaScript, including indexOf, lastIndexOf, charAt, and several others. Each method is illustrated with examples to demonstrate its functionality. Understanding these methods is crucial for effective string handling in programming.
This document explores key concepts and implementations of linked lists in C. It includes several exercises with corresponding code snippets to create, display, modify, and calculate properties of linked lists. Topics such as stack management using linked lists, insertion, deletion, reversed list generation, and list manipulations such as square values are discussed. The exercises aim to strengthen understanding of dynamic memory allocation, pointers, and data structure operations in C.
The document outlines a programming exercise for managing a library system using object-oriented programming principles, including inheritance and polymorphism. Key classes such as 'Ouvrage', 'Livre', 'Video', and 'Bibliotheque' are identified and described with corresponding attributes and methods. The functionality includes adding unique works to the library, retrieving specific works, and displaying library contents. A test class demonstrates the implementation and behavior of the system, including scenarios for book availability and polymorphic behavior through the 'affiche' method.
This document outlines two exercises focusing on object-oriented programming concepts in Java. Exercise 1 involves creating a 'TableauTrie' class to manage a sorted array of integers with methods for insertion, deletion, search, and display, along with an accompanying test class 'TestTableauTrie'. Exercise 2 requires the implementation of a 'Decouper' class for tokenizing text based on specified delimiters, with a test class 'TestDecouper' provided. Core functionalities like handling data structures, employing loops, and method writing are emphasized. The exercises demonstrate OOP principle...
This document outlines a practical assignment focused on creating and manipulating student entities using object-oriented programming. It involves defining a `Student` class with private attributes such as name, age, and average score, along with methods like comparing averages and displaying student data. The assignment also requires creating a `TestStudent` class to instantiate objects, compare their attributes, and demonstrate updates to their values. Students are prompted to refactor the code by removing specific methods and handling comparisons directly in the `main` method.
The document serves as a support guide for a practical programming workshop on linked lists. It introduces the basic operations on linked lists, including creation, insertion (at head, tail, or specific position), deletion, and search operations using C programming language. It provides structural definitions for list nodes, memory allocation techniques with `malloc`, and examples of implementation such as functions for list display and element addition/removal. The guide also includes interactive programming exercises for building and manipulating linked lists, emphasizing user interactivi...
This document focuses on implementing and manipulating linked lists in C. It details the creation of data structures, memory management using malloc, and functions for adding, removing, and searching elements in lists. Practical exercises involve writing C code for interactive list manipulation and defining procedures such as adding elements at the head or tail. The document emphasizes understanding memory allocation and pointer usage within the context of linked lists.
This document serves as a practical guide for manipulating linked lists in C. It covers the creation and management of linked list data structures, including defining nodes, memory allocation, and pointers. It provides procedures and functions for insertion (head, end, specified position), deletion, and searching of elements. Furthermore, it offers interactive examples to build and display linked lists based on user input.
This document explains and demonstrates linked lists in detail, contrasting them with arrays to establish their dynamic nature and operational flexibility. It elaborates on the creation, declaration, and core operations of linked lists in C, including addition, deletion, searching, and traversal. The document highlights the versatility of linked lists by demonstrating various examples of their implementation, such as dynamically adding elements and calculating properties like length and occurrences. Methodologies are accompanied by detailed examples and C code to illustrate practical applic...
This document comprehensively outlines the foundational structure of assembly language programs by dividing them into key segments: data, stack, and code. It explains essential declarations, variable initialization, and the use of pseudo-instructions, such as DB, DW, and DD, to define memory usage. Detailed instructions for stack and procedure usage are provided, along with examples demonstrating input/output operations via DOS interrupt functions. Exercises cover memory storage, displaying characters, keyboard input handling, and various table manipulations via assembly code.
This document explains the concept of structures in the C programming language, contrasting them with arrays and describing their syntax and usage. It provides methods to define, initialize, and utilize structures, including best practices and examples. Applications explore creating and managing data for planets, with functions to handle structured data efficiently. Finally, it delves into advanced topics like structure pointers, linked lists, and dynamic memory allocation.
The document provides an overview of pointer usage in C programming, particularly focusing on handling single pointers, double pointers, triple pointers, and arrays. It demonstrates the declaration of pointers and the invocation of various functions that use these pointers. The methodology emphasizes the distinction between arrays and pointers when passing parameters. The findings underline the correct ways to pass pointers to functions and avoid common mistakes such as including '&' with arrays.
This document provides a comprehensive guide on programming in assembly language. It introduces the structure and components of assembly programs, including segment declarations (data, stack, and code), variable initialization, and pseudo-instructions for memory management. It explores key operations like defining and utilizing stacks, procedures, and message handling using DOS interrupts. The document also includes practical exercises to create and manipulate tables, display messages on the screen, and work with keyboard inputs, emphasizing debugging and optimization.
This document outlines a programming exercise focused on creating and manipulating a `Point` class in Java. It specifies developing private attributes for coordinates and methods for accessors, mutators, displaying, and translating points. A `main` method is to be implemented for testing various functionalities, including coordinate modification and user input. The exercise emphasizes understanding object-oriented principles through practical tasks.
This document introduces six exercises focused on fundamental programming tasks. Exercises involve creating patterns, performing basic arithmetic operations, and implementing variable manipulation. It also includes practices for calculating perimeter and surface of geometric shapes, division operations, and time conversion. The exercises aim to develop computational problem-solving skills in a structured manner.
This document is a lab exercise focused on object-oriented programming (OOP) in Java. It includes two programming tasks: identifying whether a given integer is a multiple of 2, 3, or 5 and classifying a set of integers as positive, negative, zero, and even or odd. Both exercises emphasize conditional logic and loop implementation to process input and deliver comprehensive outputs. Example executions are provided to clarify expected functionality and results.












