Virtualization in operating system changes a normal operating system so that it can run different types of applications that may be handled on a single computer system by many users. The operating system may appear different to each user and each of them may believe they are interacting with the only operating system i.e. this does not interfere with user experience.Operating system virtualization can also be used to migrate a process from one instance of the operating system to another. However, all the processes in the system are isolated and there operations are strictly monitored so there are no discrepancies ... Read More
To find the power of a number, firstly set the number and the power −int n = 15; int p = 2;Now create a method and pass these values −static long power(int n, int p) { if (p != 0) { return (n * power(n, p - 1)); } return 1; } Above, the recursive call gave us the results −n * power(n, p - 1)The following is the complete code to get the power of a number −Example Live Demousing System; using System.IO; public class Demo { public static void Main(string[] args) { ... Read More
Use Stopwatch class to measure time of execution of a method in .NET −Stopwatch s = Stopwatch.StartNew();Now set a function and use the ElapsedMilliseconds property to get the execution time in milliseconds −s.ElapsedMillisecondsLet us see the complete code −Example Live Demousing System; using System.IO; using System.Diagnostics; public class Demo { public static void Main(string[] args) { Stopwatch s = Stopwatch.StartNew(); display(); for (int index = 0; index < 5; index++) { Console.WriteLine("Time taken: " + s.ElapsedMilliseconds + "ms"); } ... Read More
Firstly, create an instance of DriveInfo −DriveInfo dInfo = new DriveInfo("E");Display free space −Console.WriteLine("Disk Free space = {0}", dInfo.AvailableFreeSpace); Now, use AvailableFreeSpace property and get the percentage of free space −Double pc = (dInfo.AvailableFreeSpace / (float)dInfo.TotalSize) * 100;Here, you will get the percentage of free size in comparison with the total disk space −Console.WriteLine(" Free space (percentage) = {0:0.00}%.", pc);
To check if a string is a valid keyword, use the IsValidIdentifier method.The IsValidIdentifier method checks whether the entered value is an identifier or not. If it’s not an identifier, then it’s a keyword in C#.Let us see an example, wherein we have set the CodeDomProvider and worked with the IsValiddentifier method −CodeDomProvider provider = CodeDomProvider.CreateProvider("C#");Let us see the complete codeLExample Live Demousing System; using System.IO; using System.CodeDom.Compiler; namespace Program { class Demo { static void Main(string[] args) { string str1 = "amit"; string str2 = ... Read More
Declare a 2D array −int[] a = new int[] { 65, 45, 32, 97, 23, 75, 59 };Let’s say you want the Kth smallest i.e, 5th smallest integer. Sort the array first −Array.Sort(a);To get the 5th smallest element −a[k - 1];Let us see the complete code −Exampleusing System; using System.IO; using System.CodeDom.Compiler; namespace Program { class Demo { static void Main(string[] args) { int[] a = new int[] { 65, 45, ... Read More
Firstly, set a jagged array.int[][] arr = new int[][] { new int[] { 0, 0 }, new int[] { 1, 2 }, new int[] { 2, 4 }, new int[] { 3, 6 }, new int[] { 4, 8 } };Now, use the GetLowerBound(), GetUpperBound() and Rank property to get the lenth and rank of the array as shown in the following code ... Read More
Mobile Computing deals with human computer interaction using mobile devices. It contains mobile hardware and software as well as mobile computing devices. A mobile computing infrastructure usually uses ad-hoc networks and communication protocols. This is considerably different than a traditional computing structure as it uses fixed topology and protocols.An image describing mobile computing architecture is as follows −As seen above, the mobile computing architecture contains various mobile devices such as mobile phones, mobile tablets, laptops etc. These devices are connected to the mobile network which is a part of the internet. All the data is linked to cloud computing data ... Read More
Firstly, set the two numbers to be multiplied.val1 = 10; val2 = 20;Now cal the method to find the product.product(val1, val2);Under the product method, a recursive call will get you the product.val1 + product(val1, val2 – 1)Let us see the complete code to find the product of 2 numbers using recusion.Exampleusing System; class Calculation { public static void Main() { int val1, val2, res; // the two numbers val1 = 10; val2 = 20; // finding product Demo d = new ... Read More
To find the rank of an array, use the Rank property.Firstly, declare and initialize an array.int[,] myArr = new int[3,3];Now, get the rank.myArr.RankLet us see the complete code −Example Live Demousing System; class Demo { static void Main() { int[,] myArr = new int[3,3]; Console.WriteLine("Rank of Array : " + myArr.Rank); } }OutputRank of Array : 2
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP