• Tidak ada hasil yang ditemukan

The Concept of Constants, Variables, Population and Samples 2

N/A
N/A
Fikri Sukses

Academic year: 2024

Membagikan "The Concept of Constants, Variables, Population and Samples 2"

Copied!
13
0
0

Teks penuh

(1)

The Concept of Constants, Variables, Population and

Samples

(2)

Constants

Constant is C refer to fixed value that do not change during the execution of a program. C supports several types of constant.

1) Integer constants 2) Real constants

3) Single character constant 4) String constant

01

(3)

Integer constant

 An integer constant refers to a sequence of digits. There are three types of integer namely, decimal integer, octal integer, hexadecimal integer.

 Decimal integer consist of a set of digit, 0 through 9, preceded by an optional - or + sign.

Examples:- 123,-321,0,654321,+78

 Embedded spaces, commas, and non-digit character are not permitted between digits. For examples:-15750,20000,$1000

 A sequence of digits preceded by Ox or oX is considered as hexadecimal integer. They may also include alphabets A through f. the letter A through F represent the numbers 10 through 15. Examples:-0X2,0x9F,0Xbcd 0x

 We rarely use octal and hexadecimal numbers in programing.

 The largest integer value that can be stored in machine-dependent. It is 32767 on 16-bit machines and 2,147,483,647 on 32 bit machines

(4)

Real constants

 Integer number are inadequate quantities that vary continuously, such as distances, heights, temperature, prices, and so on. These quantities are represented by numbers containing fractional parts like 17.548, such numbers are called real constants.

 These numbers are shown in decimal notation, having a whole number followed by a decimal point and the fractional part..

 A real number may also be expressed in exponential notation. For example, the value 215.65 may be written as 2.165e2 in exponential notation, e2 means multiply by 10-10.

 The mantissa is either a real number expressed in decimal notation or an integer. The exponent is an integer number with an optional plus or minus sign. The letter e separating the mantissa and the exponent can be written in either lowercase or uppercase. Since the exponent causes the decimal point to "float", this notation is said to represent a real number in floating point form

Example:-0.65e4, 12e-2 1.5e+5

(5)

Single Character Constant

 A single character constant contains a single character enclosed within a pair of single quote marks. Example:- '5', 'X‘

 Character constant have integer values known as ASCII value.Example:-printf("%d", 'a')Would print the number 97, the ASCII value of the letter a, the statement

 Since each character constant represents an integer value, it is also

possible to perform aritlunetic operations on characte

(6)

String constant

 * A string constant is a sequence of characters enclosed in double quotes. The characters may be letters, numbers, special characters and blank space. Example:-"Hello!", "WEL DONE"

 Remember that a character constant is not equivalent to the single

character string constant. Further, a single character string constant

does not have an equivalent integer value while a character constant

has an integer value. Character strings are often used in programs to

build meaningful programs.

(7)

Variables

02

 A variable is a data name that be used to store a data value. Unlike constant that remain unchanged during the execution of a program, a variable may take different values at different times during execution.

 A variable name can be chosen by the programmer in a meaningful way so as to reflect its function or nature in the program. Examples:-Average, height, Total

 As mentioned earlier, variable names consist of letter, digits, and the underscore() character, subject to the following conditions:

1) They must begin with a letter. Some systems permit inderscore as the first character 2) Uppercase and lowercase are significant. That is, variable Total is not the same as

total or TOTAL.

3) It should not be a keyword.

4) White space is not allowed.

(8)

03

The population Number = N Mean = m

Standard deviation = s

The Population vs. The Sample

Cannot afford to measure parameters of the whole population

We will likely never know these (population parameters - these are things that we want to know about in the population)

(9)

04 Sampling in Quantitative Research

Definition

Quantitative research involves collecting numerical data and analyzing it

statistically. Sampling in quantitative research refers to selecting a subset of

individuals from a larger population to represent that population in research

studies

(10)

Types of Sampling

 Random Sampling: Every member of the population has an equal chance of being selected.

This helps to minimize bias and ensures that the sample is representative of the population.

 Stratified Sampling: The population is divided into subgroups (or strata) based on certain characteristics, and then random samples are taken from each stratum. This ensures representation from all groups within the population.

 Systematic Sampling: Researchers select every nth member from the population after randomly selecting a starting point. It's simpler than random sampling but still provides a degree of randomness.

 Cluster Sampling: The population is divided into clusters, and then clusters are randomly

selected for inclusion in the sample. This method is often more practical and cost-effective for

large populations.

(11)

05 Sampling in Qualitative Research

Definition

Qualitative research focuses on understanding and interpreting experiences,

perceptions, and behaviors. Sampling in qualitative research involves

purposeful selection of individuals, groups, or settings to explore and

understand phenomena in-depth. Rather than aiming for statistical

representation, qualitative sampling prioritizes depth of understanding and

richness of data.

(12)

Types of Sampling

 Purposive Sampling: Researchers select participants based on specific criteria relevant to the research question. This allows for targeted exploration of particular characteristics or experiences.

 Snowball Sampling: Participants are recruited based on referrals from existing participants. This method is useful for accessing hidden or hard-to-reach populations.

 Convenience Sampling: Researchers select participants based on convenience or accessibility. While convenient, this method may introduce bias and limit the generalizability of findings.

 Theoretical Sampling: Sampling is guided by emerging theories or concepts during data

collection. This iterative process allows researchers to refine and develop theories as data

collection progresses.

(13)

THANK YOU

Referensi

Dokumen terkait