0% found this document useful (0 votes)
2 views6 pages

OST Lab Procedures

The document outlines various laboratory experiments focusing on programming procedures in Linux and PHP. It includes experiments on Linux commands, basic arithmetic operations, loops, arrays, sorting, class usage, date calculations, inheritance, string manipulation, validation, CRUD operations, and user input handling. Each experiment provides a step-by-step procedure for implementation and concludes with an exit command.

Uploaded by

techxtream03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

OST Lab Procedures

The document outlines various laboratory experiments focusing on programming procedures in Linux and PHP. It includes experiments on Linux commands, basic arithmetic operations, loops, arrays, sorting, class usage, date calculations, inheritance, string manipulation, validation, CRUD operations, and user input handling. Each experiment provides a step-by-step procedure for implementation and concludes with an exit command.

Uploaded by

techxtream03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

OST Lab Record - Procedures

Experiment 1: Linux Commands


Procedure:

- Open a terminal on a Linux system.

- Execute commands like ls, pwd, cd, mkdir, and rm.

- Use file manipulation commands like cp, mv, and touch.

- Manage processes with ps, kill, and top.

- Execute networking commands like ping, ifconfig, and netstat.

Experiment 2(A): Odd or Even


Procedure:

- Take an integer input from the user.

- Use the modulus operator % to check divisibility by 2.

- If remainder is 0, print 'Even'; otherwise, print 'Odd'.

- Display the result.

- Exit the program.

Experiment 2(B): Check if a Number is Positive, Negative, or Zero


Procedure:

- Take a number as input from the user.

- Compare the number with zero.

- If greater than zero, print 'Positive'.

- If less than zero, print 'Negative'; otherwise, print 'Zero'.

- Display the result and exit the program.

Experiment 3(A): Print Even Numbers from 1 to 20 (For Loop)


Procedure:

- Use a for loop starting from 2 to 20.

- Increment the loop variable by 2 in each iteration.


- Print the loop variable in each step.

- Continue the loop until 20 is reached.

- Exit the program.

Experiment 3(B): Sum of First 10 Natural Numbers (While Loop)


Procedure:

- Initialize a sum variable to 0.

- Use a while loop to iterate from 1 to 10.

- Add each number to the sum variable.

- Display the final sum after the loop ends.

- Exit the program.

Experiment 3(C): Multiplication Table of 5 (Do-While Loop)


Procedure:

- Initialize a variable to 1.

- Use a do-while loop to multiply the number 5.

- Print each multiplication result up to 10.

- Stop when the loop reaches 10.

- Exit the program.

Experiment 4(A): Store and Display 5 Student Names


Procedure:

- Create an array to store 5 student names.

- Use a loop to access each name in the array.

- Print each name one by one.

- Ensure proper formatting in the output.

- Exit the program.

Experiment 4(B): Student Marks (Associative Array)


Procedure:

- Create an associative array to store student names as keys and marks as values.
- Use a loop to iterate through the array.

- Print each student's name along with their marks.

- Ensure proper formatting of output.

- Exit the program.

Experiment 4(C): Student Details (Multidimensional Array)


Procedure:

- Create a multidimensional array to store student details (name, marks, grade).

- Use a loop to iterate through each student’s data.

- Print the student's name, marks, and grade in a structured format.

- Ensure proper output formatting.

- Exit the program.

Experiment 5: Sorting an Array


Procedure:

- Create an array with random numbers.

- Use the sort() function to arrange them in ascending order.

- Loop through the array to print sorted values.

- Display the sorted array properly.

- Exit the program.

Experiment 6: Maximum and Minimum in an Array


Procedure:

- Define an array with numerical values.

- Use max() to find the largest value.

- Use min() to find the smallest value.

- Print both maximum and minimum values.

- Exit the program.

Experiment 7: Factorial Using Class


Procedure:
- Create a class named Factorial.

- Define a method to calculate the factorial.

- Take a number as input and call the method.

- Display the computed factorial.

- Exit the program.

Experiment 8: Date Difference Calculation Using PHP


Procedure:

- Create two DateTime objects with different dates.

- Use the diff() function to find the difference.

- Extract years, months, and days from the difference.

- Display the calculated difference.

- Exit the program.

Experiment 9: Inheritance in PHP


Procedure:

- Create a parent class BankAccount.

- Define methods for deposit and get balance.

- Create a child class SavingAccount that inherits from BankAccount.

- Implement an interest rate feature in SavingAccount.

- Display the final account balance after interest is added.

Experiment 10: String Manipulation Functions


Procedure:

- Take a string as input.

- Perform operations like length calculation, word count, and reverse.

- Use str_replace() for replacing words in a string.

- Convert text to uppercase and lowercase.

- Display all modified string outputs.


Experiment 11: Call by Value and Call by Reference
Procedure:

- Define a function to modify a variable by value.

- Pass a variable to the function and modify it inside.

- Observe that the original variable remains unchanged.

- Now, pass a variable by reference using &.

- Observe that the original variable gets updated.

Experiment 12: Email ID Validation


Procedure:

- Take an email ID as input.

- Use a regular expression pattern to validate it.

- Check for correct format (username, @, domain).

- Display 'Valid' or 'Invalid' based on validation.

- Exit the program.

Experiment 13: Mobile Number Validation


Procedure:

- Take a mobile number as input.

- Use a regex pattern to check if it has 10 digits.

- Validate using preg_match().

- Display 'Valid' or 'Invalid' based on the match.

- Exit the program.

Experiment 14: CRUD Operations in PHP with MySQL


Procedure:

- Establish a connection to the MySQL database.

- Create a table if it doesn’t exist.

- Perform Insert, Read, Update, and Delete (CRUD) operations.

- Display success messages for each operation.


- Close the database connection.

Experiment 15: Read and Print a String in PHP (CLI Mode)


Procedure:

- Take a string input using readline().

- Store the input in a variable.

- Print the stored string using echo.

- Ensure correct input handling.

- Exit the program.

Experiment 16: Factorial Calculation Using a Web Interface


Procedure:

- Create an HTML form to take user input.

- Use PHP to process the input and calculate the factorial.

- Implement a function to compute factorial using recursion or loops.

- Display the result dynamically on the webpage.

- Exit the program.

You might also like