1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dennis_Churaev [7]
3 years ago
15

Describe the three functions of all programming languages and list at least two specific examples of each. The examples can be f

rom your personal experience, or anything you’ve read or watched in the course so far. The three functions of all programming languages are input, execution and collection.
Computers and Technology
2 answers:
natta225 [31]3 years ago
8 0

Answer:

The 3 functions of all programming languages are Input, Execution and collection.

They are described below:

Explanation:

1. <u>INPUT</u>: An input function can be defined as the function in programming that enables or allows the computer take in an input in form of any data type from the user. The input is either stored directly into a variable identifier or processed. A real-life scenario of an input function is taking in food. The intake of any substance into the mouth can be likened to an input function. We take in food into the body through the mouth and this is processed within the body.

Another example of input in a real-life scenario is dumping your trash into the bin. In this case, the bin is taking your trash bag as an input.  An input function in programming can take in integers, strings, character, float, arrays or any kind of data type. An input function allows the user send information to the computer using the keyboard, voice, gestures and other forms of communication.

  • <u>Examples of Input Function using C# programming language</u>

<em>Console.WriteLine("Please type any input from keyboard and press enter:");   </em>

<em>string userName = Console.ReadLine(); </em>

From the above example, In the first line of code, the compiler asks the user to input anything via the keyboard.

In the second line of code, the compiler takes in whatever the user has typed and stores it as a variable that we defined as userinput.<em> </em>

  • <u>Example of Input Function Using Python programming language</u>

<em>print('Type in your name:') </em>

<em>username = input() </em>

The first line of code requests that the user types in his name as an input, then Second line of code takes in the input and stores it as a variable declared as username

2. EXECUTION: execution in programming can be described as the process of performing some kind of operation as instructed by the code. This means that the computer reads through the code and performs any operation that it is asked to perform. such execution operation may include arithmetics, iteration, comparison and as many instructions as written in the code.

A real life scenario of execution is when you press the "play" button of an ipod. The ipod executes the "play" action and plays any song within in.

Another example is pressing 2+2 in your calculator and pressing "=" sign. The calculator performs the 2+2 operation and gives a result.

So we can then say that for every execution there is usually a result.  

  • <u>Examples of Execution Function using C# programming language</u>

<em>class ExecuteExample</em>

<em>  { </em>

<em>    static void Main(string[] args) </em>

<em>    { </em>

<em>      int additionop= 100 + 500; </em>

<em>     } </em>

<em>  }</em>

In the code above, execution occurs at the highlighted line. The compiler is asked to add the numbers 100 and 500. The act/process of adding both numbers is called EXECUTION.

  • <u>Example of Execution Function Using Python programming language</u>

<em>print('Type in your name:') </em>

<em>username = input() </em>

<em>print('We just executed, ' + username )</em>

Continuing from our code in the "input example" . As seen in the code above, execution occurs at the point where the computer prints the output of the user's input. In this case the computer prints "we just executed, + whatever value the user had passed as an input."

3. COLLECTION: Collection in programming is used to describe the process where a computer objects collects and groups  similar elements to form a single unit. This collection can be a group of similar data types.

A real life example of a collection is a Queue of people at an ATM. This can define the Queue collection type. usually this kind of collection is considered as a First in First out collection.

Another example of collection can be a List of cars in a Ford car garage. This garage takes in a range of cars that are Ford models only.

  • <u>Example of Collection Function using C# programming language</u>

List : A List is a type of collection as seen below:

<em>var listcollect = new List<string>(); </em>

<em>listcollect .Add("fordexplorer"); </em>

<em>listcollect .Add("fordedge"); </em>

<em>listcollect .Add("fordescape"); </em>

<em>listcollect .Add("fordtruck"); </em>

<em>foreach (var car in listcollect) </em>

<em>{ </em>

<em>    //do somethin</em>

<em>}</em>

The above code creates a collection(list) of the car names as a string in a tipper garage, adds elements(items) to this list and iterates through the list. This is a typical example of a collection.

  • <u>Example of Collection Function using C# programming language</u>

Queue: a queue is a case of colleciton that uses the first in first out idea. The first in first out concept is : first element to be taken in is pushed out first also known as FIFO:

<em>class ExmapleofQueue</em>

<em> { </em>

<em>  static void Main(string[] args) </em>

<em>  { </em>

<em>   Queue sampleQueue= new Queue(); </em>

<em>   sampleQueue.Enqueue(1); </em>

<em>   sampleQueue.Enqueue(2); </em>

<em>   sampleQueue.Enqueue(3); </em>

<em>   foreach (Object numberel in sampleQueue) </em>

<em>   { </em>

<em>    //do something</em>

<em>   }</em>

<em>}</em>

<em>}</em>

<em>From example above, we can see that we created a queue called sampleQueue. This holds a queue of integers.</em>

<em />

Lerok [7]3 years ago
4 0

Answer:

3 different types of user defined functions are:

  • Function with no arguments and no return value.
  • Function with no arguments and a return value.
  • Function with arguments and no return value.

Explanation:

Function with no arguments and no return value.

#include<iostream.h>

#include<conio.h>

void main()    // function declaration

{

   greatNum();        // function call

   return 0;

}

void greatNum()        // function definition

{

   int i, j;

   if(i > j) {

cout <<"The greater number is : "<< i;

   }

   else {

      cout <<"The greater number is : "<< j;

}

}  

Function with no arguments and a return value.

#include<iostream.h>

int Num();       // function declaration

int main()

{

   int r;

   r= Num();        // function call

  cout<<" The number is "<< r;

   return 0;

}

int Num()        // function definition

{

   int i, j, gNum;

   if(i > j) {

       gNum = i;

   }

   else {

       gNum = j;

   }

   return gNum;

}

The following code determine the input execution and collection of function with return and no return type

You might be interested in
Write a C program that creates two threads to run the Fibonacci and the Runner processes. Threads will indicate the start and th
OleMash [197]

Answer:

see explaination

Explanation:

#include <pthread.h>

#include <stdio.h>

int sumOfN = 0;

int arr[1000];

int n;

void * findSumOfN(void *a){

printf("Thread 1 Starting\n");

sumOfN = (n * (n+1)) / 2; //finds sum of first n natural numbers

printf("Thread 1 Finished\n");

pthread_exit(0);

}

void * fibonacci(void *a){

printf("Thread 2 Starting\n");

arr[0]=0;

arr[1]=1;

for(int i=2;i<n;i++) //find fibonacci numbers iteratively

arr[i]=arr[i-1]+arr[i-2];

printf("Thread 2 Finished\n");

pthread_exit(0);

}

int main(void){

printf("Please enter the value of n \n");

scanf("%d", &n);

if (n <= 0)

{

printf("Wrong input ! \n"); //input validation

return 0;

}

pthread_t thread1, thread2;

pthread_create(&thread1,NULL, findSumOfN, NULL); //Create threads

pthread_create(&thread2,NULL, fibonacci, NULL);

pthread_join(thread1,NULL); //Start threads

pthread_join(thread2, NULL);

printf("The sum of first %d numbers is : %d \n",n, sumOfN);

printf("The first %d fibonacci numbers are : \n",n);

for (int i = 0; i < n; ++i)

{

printf("%d ", arr[i]);

}

printf("\n");

return(0);

}

3 0
3 years ago
What is a risk or an effect of software piracy?
Butoxors [25]
Piracy is a term used to describe the practice of obtaining or using software in a manner that is illegal or not in keeping with the terms under which the software was distributed. This can range from purchasing or copying the software, to using the software without a license, to selling, renting, or otherwise distributing it without authorization.<span>The Business Software Alliance estimated the losses to software companies in 2005 as a result of piracy at over $30 billion.</span>
5 0
3 years ago
Read 2 more answers
After adding an image to her flyer, Danica played around to see which layout would look the best. At one point, her text was on
Norma-Jean [14]

Answer:

Position Feature

Wrap text feature

Picture tools

Explanation:

3 0
2 years ago
Read 2 more answers
Sandie is writing a report for her environmental science class. She has asked her older sister who is away at college to proof h
vichka [17]
Help each other because if the other sister is older she should have more experience and knowledge

8 0
2 years ago
Read 2 more answers
Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the follo
Strike441 [17]

Answer: str[0].toUpperCase();

Explanation:

str[0] is pointing to the first character of the entire string and the code str[0].toUpperCase() will convert the characters to upper case if they are in lowercase and will remain unchanged if they are already in upper case.

7 0
2 years ago
Other questions:
  • A technician wants to create a new partition on a new additional hard drive. what tool should be used?
    15·1 answer
  • In an advanced word processing program which type of image or graphic is available in a variety of formats and styles?
    12·2 answers
  • Defeating authentication follows the method–opportunity–motive paradigm.
    5·1 answer
  • Which route of entry could chemicals use to enter through the body’s airways?
    8·1 answer
  • When reading words using a Scanner object's next method, _________. a. any characters at the beginning of the input that are con
    5·1 answer
  • You have created a new dhcp scope with address range 192.168.1.1 to 192.168.1.254. you have five servers configured with static
    9·1 answer
  • Did anyone do 5.7.5 Factorial on Code HS??<br><br><br><br> 20 POINTS
    9·1 answer
  • In the second example with modulus math, why can't Eve find the solution?
    10·1 answer
  • . Imagine that you were programming without an IDE. What problems might you encounter?​
    12·1 answer
  • You have implemented an access control method that only allows users who are managers to access specific data. Which type of acc
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!