Computer Science - 9210 OxfordAQA

Subroutines (procedures And Functions)

Visão Geral

Open the skeleton program that Paper 1 is built around and you will not find one long list of instructions. You will find a dozen named blocks: one that creates the board, one that places the snakes and ladders, one that displays the board, one that makes a move. Nothing forced the author to write it that way, and every real program is written that way, which is a strong hint that something is being gained.

This lesson covers what a subroutine is, why programs are built out of them, and the two channels through which data travels between a subroutine and the code that called it. Parameters carry data in; return values carry it back out. You will also meet local and global variables, which is where the specimen paper puts two of its marks, and you will learn to say precisely what happens when a subroutine is called rather than waving at it.

Objetivos

  1. Understand the concept of subroutines.
  2. Explain the advantages of using subroutines in programs. Use and describe the use of parameters to pass data within programs.
  3. Use subroutines that return values to the calling routine.

Mapa mental

Este tema esta mapeado para mostrar como as ideias se ligam.

Abra o mapa mental na aplicacao

Nota de Aula

The specification's definition is worth learning word for word, because it is compact and it earns marks: a subroutine is a named out of line block of code that may be executed, or called, by simply writing its name in a program statement.

Apontamento completo disponivel na aplicacao Green Bridge

Instale a aplicacao Green Bridge CBT no telemovel ou computador para aceder a biblioteca IGCSE completa: exames anteriores, criterios de correcao, mapas mentais, cartoes de estudo e licoes em audio.

Notas de aula completas com diagramas
Assistente de aprendizagem com IA
Simulacros cronometrados corrigidos assim que termina
Disponível para Android, Windows, macOS e Linux Aplicacao iOS em breve

Avaliação da Lição

Parabéns por concluir a lição em Subroutines (procedures And Functions). Agora que você explorou o conceitos e ideias-chave, é hora de colocar seu conhecimento à prova. Esta seção oferece uma variedade de práticas perguntas destinadas a reforçar sua compreensão e ajudá-lo a avaliar sua compreensão do material.

Irá encontrar uma mistura de tipos de perguntas, incluindo perguntas de escolha múltipla, perguntas de resposta curta e perguntas de redação. Cada pergunta é cuidadosamente elaborada para avaliar diferentes aspetos do seu conhecimento e competências de pensamento crítico.

Use esta secção de avaliação como uma oportunidade para reforçar a tua compreensão do tema e identificar quaisquer áreas onde possas precisar de estudo adicional. Não te deixes desencorajar pelos desafios que encontrares; em vez disso, vê-os como oportunidades de crescimento e melhoria.

  1. Which statement best describes a subroutine? A. A variable that holds several values B. A named out of line block of code that is executed by writing its name C. A loop that repeats a fixed number of times D. A file that stores program output Answer: B
  2. How many parameters does the subroutine SUBROUTINE Total(A, B, C) have? A. 0 B. 1 C. 3 D. It depends on the call Answer: C
  3. Which statement about a local variable is correct? A. It can be used anywhere in the program B. It uses memory for the whole time the program is running C. It can be used only within the subroutine it is declared in D. It must be a parameter Answer: C
  4. What is the difference between a procedure and a function? A. A function returns a value and a procedure does not B. A procedure can take parameters and a function cannot C. A function is always shorter D. A procedure cannot be called more than once Answer: A
  5. Which is NOT an advantage of using subroutines given in the specification? A. The program runs faster on every machine B. Subroutines can be re-used C. Subroutines can be tested independently D. The structure of the program is clearer Answer: A

Resolva estas questoes na aplicacao

Resolva estas questoes na aplicacao

Pratique Questões Simuladas

Quer praticar questões simuladas sobre Subroutines (procedures And Functions)? Descarregue a aplicação Green Bridge CBT para aceder a questões simuladas e avaliações completas sobre este tópico.

Descarregar a aplicação na Google Play Store

Tudo o que precisas para te destacares no JAMB, WAEC e NECO.

Green Bridge CBT Mobile App
Assistente de Chat de Aprendizagem Personalizada com IA
Mais de 200.000 questões de exame do IGCSE, JAMB, WAEC e NECO
Mais de 1200 Notas de Aula
Suporte Offline - Aprenda a Qualquer Hora, em Qualquer Lugar
Horário da Ponte Verde
Resumos de Literatura & Possíveis Perguntas
Acompanhe o Seu Desempenho e Progresso
Explicações Detalhadas para uma Aprendizagem Abrangente