Program to sort number in ascending order

#include <stdio.h>
int main()
{
int arr[100];
int size, i, j, temp;
/*
* Read size of array and elements in array
*/
printf("Enter size of array: ");
scanf("%d", &size);
printf("Enter elements in array: ");
for(i=0; i<size; i++)
{
scanf("%d", &arr[i]);
}
/*
* Array sorting code
*/
for(i=0; i<size; i++)
{
for(j=i+1; j<size; j++)
{
/*
* If there is a smaller element towards right of the array
then swap it.
*/
if(arr[j] < arr[i])
{
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
/*
* Prints the sorted array
*/
printf("\nElements of array in sorted ascending order: ");
for(i=0; i<size; i++)
{
printf("%d\t", arr[i]);
}
return 0;
}

Q.2 Is C or C++ advantageous and why?
C is definitely simpler to implement. However, it has a few limitations as it is restricted to a certain
level as functions are to be defined over and over again to be implemented.
On the other hand C++ implements the use of modules which introduces a non-linear mode of
operation. This was the foundation of Graphical User Interface (GUI) when more than one course of

char *rev.rev). Prior to sending the data. it is broken into individual packets and shifted through the core network and radio. rev = strrev(str). unlike C.5 Stop Band A stopband is a band of frequencies.7 GPRS General Packet Radio Service (GPRS) is a packet oriented mobile data service on the 2G and 3G cellular communication system's global system for mobile communications(GSM). Q. such as a filter or telephone circuit. through which a circuit. Q. does not allow signals to pass. The data is then reassembled at the recipient's end. It enables the sending and receiving of compact data bursts and large data volumes across mobile phone networks. A common example is the conversion of a sound wave (a continuous signal) to a sequence of samples (a discrete-time signal).str).6 Sampling In signal processing. A sample is a value or set of values at a point in time and/or space. return 0. as well as commercial applications. . Most programs are written in C because of the simplicity and easy readability Q. printf("Reverse string is : %s".h> #include<string.h> int main(){ char str[50]. printf("Enter any string : ").4 Frequency Reuse : Frequency reuse is the practice of splitting an area into smaller regions that do not overlap so that each utilizes the full range of frequencies without interference. Q. You can say that the better among the two is C++. GPRS can be used to enable connections depending on Internet protocols that support a wide variety of enterprises. The introduction of this concept was a major step in the development of mobile phone technology. } Q. between specified limits. scanf("%s".action is possible.3 String reverse using strrev in c programming language #include<stdio. or the attenuation is above the required stopband attenuation level. sampling is the reduction of a continuous signal to a discrete signal.

int main(){ 3. . for(i=1. because they don't travel far. i < num. i. but it's mainly designed for communicating over short distances less than about 10m or 30ft. printf("\nEnter no of elements :"). f=f*i. 11.9 Write a program on factorial 1. //Read n elements in an array for (i = 0. and medical gadgets. smallest. 8. are theoretically more secure than wireless networks that operate over longer ranges. and cellphones. Bluetooth sends and receives radio waves in a band of 79 different frequencies (channels) centered on 2. i++) { if (a[i] < smallest) { smallest = a[i]. 13. scanf("%d".&num). int i. &num).h> 2.8 Bluetooth Bluetooth is a similar radio-wave technology. such as Wi-Fi.Q. Q. scientific. printf("Enter a number: ").i<=num.i++) 9. 5. 6. 4. #include<stdio.h> int main() { int a[30]. television. return 0. 10. i < num. i++) scanf("%d". &a[i]). } } // Print out the Result printf("\nSmallest Element : %d".num.10 C program to find the smallest number from an array #include<stdio. smallest). printf("Factorial of %d is: %d". and reserved for use by industrial. 7. } Q. set apart from radio. //Consider first element as smallest smallest = a[0].f=1.f). num.num. for (i = 0.45 GHz. 12. scanf("%d".

i++){ if(num%i==0){ count++. printf("Enter a number: "). break.&n).return (0).&num). printf("First %d terms of Fibonacci series are :-\n". } Q. for ( c = 0 .13 Fibonacci series #include<stdio.num). } } if(count==0 && num!= 1) printf("%d is a prime number".i<=num/2.next). printf("Enter the number of terms\n"). } . c++ ) { if ( c <= 1 ) next = c.h> int main() { int n. second = 1.count=0. return 0. first = 0. scanf("%d". for(i=2.i. } Q. c.11 Prime number #include<stdio. first = second. } printf("%d\n". next. c < n .num).n). else printf("%d is not a prime number".h> int main(){ int num. else { next = first + second. second = next. scanf("%d".

microcomputers (smallest). which web applications run on.now most people just refer to these machines as computers or personal computers. program or process runs upon.13 Memory Leak There are two definitions (at least for me): . but it remains an Operating System. An example of a computer platform is a desktop computer with Microsoft Windows installed on it. The operating system acts as an interface between the computer and the user and also between the computer and the application.e. } Q. The term microcomputer has fallen somewhat out of favor . you need hardware and an operating system together to make a usable computer platform for a program to run on. If you took away the Java stuff. The hardware portion of a computer platform consists of a processor. I think Raymond Deng puts it very well. but a web browser isn’t an Operating System. generally an Operating System is a platform. but it would remain an Operating System (GNU/Linux). So lots of overlap. So. and storage. from smallest to largest . especially the CPU. Or you can have a platform which isn’t an OS at all. it runs on. but you can have one without the other too. A computer platform is a system that consists of a hardware device and an operating system that an application. memory. it stops being the Mac platform. Another example would be Android. A runtime library can also be a computing platform. The processor is a bit like your brain and memory is like a scratchpad for your brain to use while you're working out a problem. like the web. It used to be that people referred to different computer platforms by their physical size. An operating system sits between applications and hardware. Q. minicomputers (mid-size).return 0. take away Cocoa/Quartz and other Apple frameworks. Android is a platform and an Operating System. it’s a “stage” as Raymond puts it. but a computing platform is not necessarily a kind of operating system. managing how applications access hardware and software resources. An OS is pure software while a platform is the combination between the OS and the kind of hardware. i. I would say Windows in a operating system while a Mac is a platform. and generally a platform is an Operating System. A desktop is a hardware device and Windows is an operating system. 12 What is operating System and Platform A computing platform is the “stage” where computer programs run. This means that an operating system is a kind of computing platform. Or Mac OS X. and mainframes (largest). in order to have a functional device. it would stop being the Android platform.

This is not my own idea only. however. Service providers use the internet to make resources. such as applications (also known as Software-as-a-service) and storage. IBM’s Blue Cloud. and SLA specificity. application and bandwidth costs are covered by the provider. There are some limitations. For users. Google AppEngine and Windows Azure Services Platform. While technically it is not a leak. which can no longer be allocated again by any process during execution of allocating process. these types of clouds will provide the best economies of scale. Private Clouds .16 So a collection of lot of Virtual memory is called what ? Cloud Q.15 how do we add up memory if we don't have any other physical memory present Virtual Memory Q. It can mostly be cured by using GC techniques or detected by automated tools. or on a ‘public cloud. Q. which is no longer needed for your program to function correctly. Sun Cloud. It is nearly impossible to be detected by automated tools or programmers who is not too familiar with the code.17 How many types of Cloud are there? Public. Subtle one: Failure to release reachable memory. You can come across projects that are written in a garbage collected language but still mentions fixing memory leaks in their changelogs.14 what happens when there is memory overflow? Stackoverflow Q. it has the same implications of the naive one. Private. are inexpensive to set-up because hardware. available to the general public. Hybrid. the public cloud may not be the right fit for every organization.Naive one: Failure to release unreachable memory. It’s a pay-per-usage model and the only costs incurred are based on the capacity that is used. making it less-than-ideal for services using sensitive data that is subject to compliancy regulations. Examples of public clouds include Amazon Elastic Compute Cloud (EC2). Public Clouds A public cloud is basically the internet. security. The model can limit configuration.

automation and monitoring. Q. stored or used to . The microcontroller is usually used for more dedicated applications. Digital and Analog IO. enabling narrower channels to be used. Hybrid Clouds By using a Hybrid approach. Q. A microcontroller is 'all in one'. This will also be beneficial during predictable outages: hurricane warnings. scalability. ROM. scheduled maintenance windows. and keeping assets within the firewall. The goal of a private cloud is not sell “as-a-service” offerings to external customers but instead to gain the benefits of cloud architecture without giving up the control of maintaining your own data center. This is usually not an option for the average Small-to-Medium sized business and is most typically put to use by large enterprises. displayed. For instance during peak periods individual applications. provisioning. 17 Sensor. rolling brown/blackouts. IO all on the one chip. or portions of applications can be migrated to the Public Cloud.16 Microprocessor and Microcontroller A microprocessor generally does not have Ram. Serial ports. ROM and IO pins. ram. 15 Modulation used by Televesion All analog television systems use vestigial sideband modulation. The controlling bus is internal and not available to the board designer.Private clouds are data center architectures owned by a single company that provides flexibility. Private clouds are driven by concerns around security and compliance. a form of amplitude modulation in which one sideband is partially removed. It usually uses its pins as a bus to interface to peripherals such as RAM. A sensor is a device which is capable of converting any physical quantity to be measured into a signal which can be read. This reduces the bandwidth of the transmitted signal. This means that a microprocessor is generally capable of being built into bigger general purpose applications than a microcontroller. as such you cannot (say) increase the amount of RAM available or the number of IO ports. It is expandable at the board level due to this. companies can maintain control of an internally managed private cloud while relying on the public cloud as needed. Private clouds can be expensive with typically modest economies of scale. the processor. Q.