0% found this document useful (0 votes)
5 views9 pages

Array

The document is a lab report submitted by Roshan Kr. Yadav from St. Xavier's College on C-string handling functions and operating systems. It includes C programs for string operations such as length, copy, concatenate, compare, reverse, and input/output, as well as a discussion on types of operating systems and multitasking. The report also outlines basic command terminal operations and application management in an operating system.

Uploaded by

rbmukhiya2031
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)
5 views9 pages

Array

The document is a lab report submitted by Roshan Kr. Yadav from St. Xavier's College on C-string handling functions and operating systems. It includes C programs for string operations such as length, copy, concatenate, compare, reverse, and input/output, as well as a discussion on types of operating systems and multitasking. The report also outlines basic command terminal operations and application management in an operating system.

Uploaded by

rbmukhiya2031
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

ST.

XAVIER’S COLLEGE
MAITIGHAR, KATHMANDU, NEPAL
Phone: 01-5321365, 01-5344636

Lab report on : C-string and OS in html

Submitted By Submitted to Signature

Name: Roshan Kr. Yadav


Roll no: 904 Department of Computer Science
Class: XI St. Xavier’s College
Section: I

Submission Date: 2026/02/04


C String Handling Functions and Operating System
1. PART A: STRING HANDLING IN C (LAB TASKS)

Question 1: Length of a String


Write a C program to find the length of a string using strlen().

#include <stdio.h>
#include <string.h>
int main()
{
char str[100];
printf("enter a string :");
gets(str);
printf("length of string=%d",strlen(str));
printf("\n program executed by Roshan Kr. Yadav");
return 0;
}

2. Question 2: Copy a String


Write a C program to copy one string into another using strcpy().
#include<stdio.h>
#include<string.h>
int main()
{char a[10];
char c[10];
printf("enter a string :");
scanf("%s",&a);
strcpy(c,a);
printf("copied string: %s",c);
printf("\n program executed by Roshan Kr. Yadav");
return 0;
}
3. Question 3: Concatenate Two Strings
Write a C program to join two strings using strcat().
#include<stdio.h>
#include<string.h>
int main()
{char a[100];
char b[100];
char c[100];
printf("enter 1st string :");
scanf("%s",&a);
printf("enter 2nd string:");
scanf("%s",&b);
printf("joined string: %s",strcat(a,b));
printf("\n program executed by Roshan Kr. Yadav");
return 0;
}

4. Question 4: Compare Two Strings


Write a C program to compare two strings using strcmp() and display whether they are equal or
not.
#include<stdio.h>
#include<string.h>
int main()
{char a[100];
char b[100];
printf("enter 1st string :");
scanf("%s",&a);
printf("enter 2nd string:");
scanf("%s",&b);
if (strcmp(a,b)==1)
printf("string are equal");
else
printf("sting are not equal");
printf("\n program executed by Roshan Kr. Yadav");
return 0;

5. Question 5: Reverse a String


Write a C program to reverse a string using strrev().
#include<stdio.h>
#include<string.h>
int main()
{char a[100];
printf("enter string :");
scanf("%s",&a);
printf("reversed string: %s",strrev(a));
printf("\n program executed by Roshan Kr. Yadav");
return 0;
}

6. Question 6: Input and Output of String


Write a C program to input a string using gets() and display it using puts().
#include<stdio.h>
#include<string.h>
int main()
{char a[100];
printf("enter a string :");
gets(a);
puts(a);
printf("\n program executed by Roshan Kr. Yadav");
return 0;
}

PART B: OPERATING SYSTEM

Question 7: Types of Operating System


List any five operating systems and write their types based on working principle.

List of Operating Systems With their working Principles

1) Microsoft Windows
 It is Multitasking/Time-Sharing OS.
 It allows a user to run multiple applications simultaneously (like a browser, Word, and media
player) by switching between them quickly, sharing CPU time efficiently.

2) Linux
 It is Multiprogramming/Multi-user OS.
 It allows multiple programs to reside in memory simultaneously, increasing efficiency by keeping
the CPU busy while waiting for I/O operations. It also supports multiple users accessing the
system at the same time.

3) Android
 It is Mobile/Real-Time OS.
 Designed for mobile devices, it uses a modified Linux kernel to handle touch-based interfaces,
power management, and multitasking, often functioning as a soft real-time system to ensure quick
app responses.

4) VxWorks
 It is Real-Time Operating System.
 Designed for systems where time constraints are strict (e.g., robotics, aerospace). It guarantees
that critical tasks are completed within a specific, predefined time limit, avoiding unnecessary
delays.

5) IBM i/OS or Batch Systems


 It is Batch Operating System.
 It groups similar, large-scale jobs (like payroll or billing) together and executes them in a
sequence without any direct interaction from the user during the process.

Question 8: Multitasking Operating System


Write a short note on multitasking operating system with two examples.

Multitasking operating systems (OSs) are designed to manage multiple tasks simultaneously by
quickly switching the CPU's focus from one task to another. While a single CPU can only execute
one task at any given moment, multitasking OSs create the illusion of simultaneous task
execution through rapid context switching, which occurs in intervals so short that users typically
cannot perceive the delay. This system enhances efficiency, especially in environments where
multiple users interact with a computer.
There are two primary methods for managing task switching: cooperative multitasking, where
tasks voluntarily yield control, and preemptive multitasking, which automatically interrupts tasks
at defined intervals. This latter approach generally allows for fairer resource allocation but
requires more system resources to maintain the state of each task. Priority levels are often
assigned to processes, ensuring that critical user-interactive tasks are completed promptly,
thereby improving the user experience.
Examples:

 Windows OS: Users can run a web browser, play music in a media player, and have a Word
document open simultaneously.
 Linux: A server environment where one processor handles file management, database queries,
and user requests at the same time.

Question 9: Command Terminal (Command Prompt) Basics


Open Command Prompt / Terminal and perform the following commands:Display current
directoryList files and foldersCreate a new folderChange directoryClear the screen

I. Power on your computer.


II. Press Win + R, type cmd, and hit Enter.
III. Type cd to see your current directory path.
IV. Type dir to list all files and folders in that location.
V. Type md NewFolderName to create a new folder.
VI. Type cd FolderName to move into that specific folder.
VII. Type cls to clear the text from the screen.
Date and Time Setup Using OS

Perform the following:

View current system date and time using OS settings

Change date and time (if permission is allowed)

Steps

I. Start the computer.


II. Open settings by typing “Settings” in Windows.
III. Go to Time & Language.
IV. Go to Date & Time
V. Turn off set automatic date and time and set custom date and time.

Output
*No Permission*

Application Management

Open system settings. View installed applications. Identify any two system applications.
Write steps to uninstall an application (do not uninstall)

Steps

I. Start the computer.


II. Open Settings from Windows Key.
III. Type “Apps”
IV. Goto “Installed Apps”.
V. Click the 3 dots option on the far right.
VI. Click “Uinstall”.

Output
Multitasking operating systems (OSs) are designed to manage multiple tasks simultaneously by
quickly switching the CPU's focus from one task to another. While a single CPU can only execute
one task at any given moment, multitasking OSs create the illusion of simultaneous task
execution through rapid context switching, which occurs in intervals so short that users typically
cannot perceive the delay. This system enhances efficiency, especially in environments where
multiple users interact with a computer.
There are two primary methods for managing task switching: cooperative multitasking, where
tasks voluntarily yield control, and preemptive multitasking, which automatically interrupts tasks
at defined intervals. This latter approach generally allows for fairer resource allocation but
requires more system resources to maintain the state of each task. Priority levels are often
assigned to processes, ensuring that critical user-interactive tasks are completed promptly,
thereby improving the user experience.

Multitasking Operating System

Write a short note on multitasking operating system with two examples.

A Multitasking Operating System is a Operating System that allows a computer to execute


multiple tasks (processes) concurrently by rapidly switching the CPU between them, creating the
illusion of parallel processing. It improves efficiency by managing memory and CPU time,
enabling users to run several applications simultaneously without significant, perceptible delays.

Examples:

 Windows OS: Users can run a web browser, play music in a media player, and have a Word
document open simultaneously.
 Linux: A server environment where one processor handles file management, database queries,
and user requests at the same time.

You might also like