WorksheetsQuiz I - Programming in C
Total questions: 73
Worksheet time: 41mins
All keywords in C are in
uppercase letters
none of the mentioned
lowercase letters
sentence case letters
Who is the Father of C Language
James A. Gosling
Dr. E.F. Codd
Dennis Ritchie
Bjarne Stroustrup
C language developed at
MIT University
Stanford Lab
Haward University
AT&T Bell Laboratory
Constant is ------------------
Unknown values
Fixed values
None of these
Values changes during execution
Every C statement ends with ------------?
.
}
;
,
What is the extension of C program?
.c
.cpp
.java
.py
A sequence of instructions form a ------------.
both
program
none of these
syntax
The correct order of evaluation for the expression “z = x + y * z / 4 % 2 – 1”
* / % + - =
* / % = + -
/ * % - + =
- + = * % /
Which header file can be used to define input/output function prototypes and macros?
- math.h
- dos.h
- memory.h
- stdio.h
What will be the output of the following C code?
None of the above
No Output
Compiler error
TESTING
C is a
High level language
Low level language
Assembly language
Medium level language
Which of these is not a correct variable data type?
real
int
char
float
In which year C language is developed?
1973
1972
1970
1971
Who is father of C Language?
Dr. E.F. Codd
James A. Gosling
Bjarne Stroustrup
Dennis Ritchie
What do you need to import stdio.h a header file?
To perform input and output operations
Just a waste of time
To run the code
It helps in compilation to binary coded file
Find the output of the given program?
Compile-time error
3
3.14
None of these
What will be the output of the below C program?
Garbage Value
Compile-time error
0
9
Assuming a "double" variable named "pi" has already been declared, which of the following statements will assign the value 3.14159 to that variable?
pi 3.14159
pi(3.14159)
3.14159 = pi;
pi = 3.14159;
What is the range of signed char in C?
-32,768 to 32,767
0 to 255
-2,147,483,648 to 2,147,483,647
-128 to 127
What does the %f format specifier do in C?
Formats a character
Formats a float
Formats a string
Formats an integer
What is the output of the integer variable example?
This is my integer: 3.14
This is my integer: 10
This is my integer: b
This is my integer: 3.1415
What is the first letter of a variable in C supposed to be?
An alphabet
Any character
A special character
A digit
What punctuation is used to signal the beginning and end of code blocks?
BEGIN and END
-> and <-
{ }
( and )
The "\n" character does which of the following operations?
Character backspace
Places cursor on the next line
Character deletion
Double line spacing
What is an Identifier in C Language.?
Name of a Variable
Name of a constant
Name of a Function
All the above.
Find an integer constant.
34
3.145
"125"
None of the above
Number of Keywords present in C Language are .?
62
34
32
64
Each statement in a C program should end with.?
Colon :
Semicolon ;
None of the above.
Period . (dot symbol)
A name having a few letters, numbers and special character _(underscore) is called
reserved keywords
tokens
identifiers
keywords
What is the key difference between a signed and unsigned character data type?
Signed takes up more memory than unsigned
Signed can store positive and negative values, unsigned can only store positive
There is no difference, they are the same
Unsigned is the default, signed must be explicitly specified
Which of the following is not a valid reason to choose a specific data type when declaring a variable?
The expected range of values for the variable
Maximizing the variable's value
Ensuring compatibility with external systems or libraries
Minimizing memory usage
The format identifier '%i' is also used for _____ data type.
int
char
float
double
What is the size of 'long double' in C?
8 bytes
16 bytes
4 bytes
12 bytes
Which of the following is NOT a primitive data type in C?
char
int
float
struct
What is the range of 'float' data type in C?
0 to 255
-2,147,483,648 to 2,147,483,647
1.2E-38 to 3.4E+38
1.7E-308 to 1.7E+308
Which of the following is a valid C data type for representing a floating-point number?
float
bool
char
int
What is the size of an int data type on most 32-bit systems?
1 byte
4 bytes
2 bytes
8 bytes
What is the size of an int data type on most 32-bit systems?
1 byte
4 bytes
2 bytes
8 bytes
Identify the most appropriate type of variable for a student's grade point average (GPA). This is typically reported on a 0 to 4.0 scale (such as a GPA of 3.5).
double
char
int
string
Identify the most appropriate type of variable for the total number of teachers at FHS.
string
char
int
double
What is the format specifier for printing a double value in C?
%c
%d
%lf
%f
What is the size of the unsigned char data type in C?
2 bytes
1 byte
8 bytes
4 bytes
What is the range of the long long int data type in C?
-(2^63) to (2^63)-1
-32,768 to 32,767
0 to 65,535
0 to 18,446,744,073,709,551,615
Which data type is used to store only a single character in C?
int
char
float
double
What is the format specifier for printing a float value in C?
%d
%lf
%f
%c
What is the purpose of the void data type in C?
To store single characters
To specify no value
To store integer values
To store decimal numbers
What is the range of the float data type in C?
0 to 255
1.7E-308 to 1.7E+308
-128 to 127
1.2E-38 to 3.4E+38
What is the range of the short int data type in C?
0 to 65,535
-2,147,483,648 to 2,147,483,647
0 to 4,294,967,295
-32,768 to 32,767
Variable names are case-sensitive.
False
True
Which holds whole numbers?
String
int
double
bool
Which best describes a variable?
Variables enable programmers to work with different input devices
Variables control memory space
Variables store program data while code runs
Variables are individual values in a database table
What is the significance of the 'long' keyword in C data types?
It is used to specify variables that can hold smaller values than 'int'.
It is used to declare constant variables.
It is used to define floating-point variables.
It is used to specify variables that can hold larger values than 'int'.
Why is it important to understand data types in C programming?
Understanding data types in C programming is not important
Data types in C programming have no impact on memory allocation
Manipulation of data in C programming does not require knowledge of data types
It is important to understand data types in C programming to ensure proper memory allocation, manipulation, and interpretation of data.
What is the size of 'double' data type in C language?
4 bytes
16 bytes
8 bytes
12 bytes
Explain the difference between 'int' and 'float' data types in C.
In C, 'int' is for floating-point numbers, while 'float' is for integers.
'int' and 'float' are interchangeable data types in C.
Both 'int' and 'float' are used for integers in C.
In C, 'int' is for integers, while 'float' is for floating-point numbers.
What is the size of 'char' data type in C language?
2 bytes
1 byte
8 bytes
4 bytes
How is the size of a data type determined using the sizeof operator?
The size of a data type is determined by the number of bits it occupies in memory
The size of a data type is determined by using the sizeof operator to calculate the number of bytes it occupies in memory.
The size of a data type is determined by counting the number of characters it contains
The size of a data type is determined by the data type itself
What is the size of 'int' data type in C language?
8 bytes
4 bytes
16 bytes
2 bytes
What are the basic data types in C language?
long
string
short
int, char, float, double, void
bool
What is the purpose of the sizeof operator in C?
To determine the size of a variable or data type in bytes.
To convert data types
To control program flow
To check for memory leaks
*@Ac# is a type of ________________ data.
Alphanumeric
Alphabetic
Numeric
Symbolic
Which of the following is not a data type?
Alphabetic Data
Symbolic Data
Alphanumeric Data
Numeric Data
Which of these operation is used for division?
/
+
*
-
For the following code, what is the data type? float boat = 3.4;
decimal
boat
3.4
float
For the following code, what is the name of the variable? int game = 2;
integer
int
2
game
What kind of data type would you use for the name of your first period class?
integer
float
string
character
What data type is this value? "This is a quiz"
string
character
integer
float
What data type is this value? 'R'
float
string
integer
character
What kind of data type is this value? 9.45
float
string
integer
character
What will be the output of the following C code?
2
8
9
10
What will be the output of the following C code?
3 2 3
2 2 3
3 2 2
2 3 3
What will be the output of the following C code?
3 2 3
2 2 3
3 2 2
2 3 3
What will be the output of the following C code?
Run time error
7
8
Depends on compiler
