Introduction to Algorithms and Programming

EnviousPegasus avatar
EnviousPegasus
·
·
Download

Start Quiz

Study Flashcards

10 Questions

What happens when an array is passed into a function?

A pointer to the first element of the array is passed.

What is the difference between local and global variables?

Local variables are seen only within the main, while global variables are seen by the main and all functions.

How can a function return a single-dimension array?

By declaring a function returning a pointer.

What is the purpose of declaring a pointer to an array as static?

The lifetime of the array extends until the end of the program.

What is a structure (struct) in programming?

A way to group several variables in one place.

What is a member of a structure?

A variable within the structure.

How are members of a structure accessed?

Using the dot syntax (.)

What is the syntax for declaring a function that takes an array as an argument?

void duplicate (int arr[], int size); or void duplicate(int arr, int size); or Void duplicate (int *arr, int size);

What happens when a function is declared to return a pointer to an array?

The function returns a reference to the array.

What is the advantage of using structures (structs) in programming?

They allow you to group related variables together, making it easier to work with and organize data.

This quiz covers the basics of algorithms, including pseudocode, flowcharts, compound conditions, and switch-case statements. It also touches on programming concepts, such as break and continue statements.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser