Last Updated on April 23, 2022 by Admin 3
Introduction to computer programming, variables, and comments M1 Test
-
The feature of a high-level language which makes it possible to use that language on many different computers is called:
- portability
- availability
- compatibility
-
A file which contains a computer program translated into machine language is called:
- an executable file
- a source file
- an interchange file
-
Select all the true statements:
- The “C” language compiler is case-sensitive
- The reserved keywords cannot be used as variable as variable names
- You can write multiline comments in the “C” language
- The decimal value of
012
(octal) is10
- Nesting comments is a recommended pratice
- The decimal value of
0x11
(hexadecimal) is16
-
The sets of rule that determine the appropriate ways of combining symbols which from correct fragments of code in a programming language are called:
- syntax
- semantics
- lexis
-
Which line of code must you insert in order for the program to produce the expected output?
Expected output:1
Code:
#include <stdio.h> int main() { int var = 1; print("%d \n", var);
}
placed at the end of the code block
return 0;
placed at the end of the code block
int var;
placed above
int var = 1;
- No change are required – the program will compile and produce the expected output
-
What is the value of the
var
variable after the extension of the following snippet of code:int var = 2; var = 4 var = var + 6; var = var + var;
20
24
22
10
-
Which of the following identifiers are legal variable names in the C language?
Select three answers.
_3monthsOld
three_months_old
month3
3monthsOld
int
three months
-
The
return
statement used in a function:- ends the function execution
- continuously repeats the function execution
- repeats the function execution once, and then ends the function execution
-
Data of type
float
is:- a fractional number
- an integral number
- an internal number
- an integer number
-
What is the output of the following program?
#include <stdio.h> int main() { int var; var = 1; var = 2; /* var = 3; */ print("%d", var); return 0; }
2
3
6
1