Shared Flashcard Set

Details

Pascal
N/A
11
Computer Science
Undergraduate 4
09/11/2011

Additional Computer Science Flashcards

 


 

Cards

Term
What is the basic framework for starting a program in pascal?
Definition

program Something;
 
begin
  
end.

Term
How would you define a unit to be used in a program?
Definition

program something;
 
uses
   unitName;
 
begin
  
end.

Term
Define an integer variable and assign a value to it.
Definition

program Variables;
 
var
   i: Integer;
 
begin
   i := 5;
end.

Term
create multiple variables of different types.
Definition

program Variables;
 
var
   i, j: Integer;
   s: String;
 
begin
end.

Term
Define and initialize an Integer, String, and Boolean variable.
Definition

program Variables;
 
var
   i: Integer;
   s: String;
   b: Boolean;
 
begin
   i := -3;
   s := 'Hello';
   b := True;
end.

Term
Mathematical manipulations
Definition

program Math;
 
var
   Num1, Num2, Ans: Integer;
 
begin
   Ans := 1 + 1;
   Num1 := 5;
   Ans := Num1 + 3;
   Num2 := 2;
   Ans := Num1 - Num2;
   Ans := Ans * Num1;
end.

Term

What is the value of s?

 

var
   s: String;
 
begin
   s := '1' + '1';
end.

Definition
11
Term

what is the value of t?

 

var
   t: Integer;
 
begin
   t := 1 + 1;
end.

Definition
2
Term
Read in an integer from the keyboard and assign it to a variable x.
Definition

program Something;
 
uses crt;
 
var
   x: Integer;

begin
   Readln(x);
end.

Term
Read in a character from the keyboard and assign it to variable p.
Definition

program Variables;
 
uses crt;
 
var
   p: Char;
 
begin
   p := ReadKey; {reads one character}
end.

Term
How do yo print variables to the screen?
Definition

program Variables;
 
uses crt;
 
var
   i: Integer;
   s: String;
   c: Char;
 
begin
   Readln(i);
   Readln(s);
   c := ReadKey;
end.

Supporting users have an ad free experience!