Font size
S
M
L
XL
Worksheetscp1sem
Total questions: 101
Worksheet time: 51mins
Name
Class
Date
1.
All programming languages follow certain grammar while coding. What is this grammer called as?
a)
instruction
b)
command
c)
syntax
d)
information
2.
Set of instructions are written to perform a task. What is this set of instructions called as?
a)
Information
b)
Data
c)
Program
d)
Syntax
3.
High level language is converted in to machine language using a translator. What type of translator is used in C & C++ ?
a)
Interpreter
b)
Compiler
c)
Assembler
d)
Decoder
4.
High level language is converted in to machine language using a translator. What type of translator is used in the popular programming language Python?
a)
Interpreter
b)
Compiler
c)
Assembler
d)
Decoder
5.
Which of the following converts the program into object code, that can be directly executed by the machine after linking?
a)
An Interpreter
b)
A Compiler
c)
An Assembler
d)
A Decoder
6.
Which of the following directly executes instructions written in programming language, without converting to object code or machine code?
a)
An Interpreter
b)
A Compiler
c)
An Assembler
d)
A Decoder
7.
Which of the following translates a program written in assembly language into machine language?
a)
An Interpreter
b)
A Compiler
c)
An Assembler
d)
A Decoder
8.
Compiler uses few tools. Which tool merges the object files and create executable files?
a)
Pre-processor
b)
Linker
c)
Loader
d)
Assembler
9.
The Preprocessor removes_____ from the source code.
a)
comments
b)
header files
c)
comments & heade rfiles
d)
names of variables
10.
Which part of Operating System, loads the executable files in the memory and helps in running the programs?
a)
Pre-processor
b)
Linker
c)
Loader
d)
Assembler
11.
Which of the following translates the source code, one line at a time.
a)
An Interpreter
b)
A Compiler
c)
An Assembler
d)
A Decoder
12.
Which of the following is designed to replace binary machine code with an easy understandable mnemonic code.
a)
High Level Language
b)
Middle level Language
c)
Assembly language
d)
Machine Language
13.
Whitespace character does not giveany visible mark, but occupies an area on the page. Which of the following does not result in to white space?
a)
\\' backslash
b)
'\n' newline
c)
'\v' vertical tab
d)
'\r' carriage return
14.
Keywords are predefined reserved words in c. Which of the following ia a set of keywords in c?
a)
no, for, do
b)
true, while, constant
c)
do, for, if
d)
type, float, int
15.
Which keyword is used to prevent any changes in the variable within a C program?
a)
static
b)
const
c)
constant
d)
fixed
16.
A programmer has declared the variables as
int A = 9;
float a = 9.6;
Which of the following statement is correct
a)
Value in A will be 9.6
b)
Output depends on compiler
c)
Invalid declaration. Error
d)
Valid declaration. No error
17.
What is the result of the following
const int i = 3.67;
i = i + 3;
a)
3.67
b)
6.67
c)
6
d)
Error
18.
What value is stored in x, if its is declaed as
int i = 3.67;
a)
3.67
b)
"3.67"
c)
3
d)
4
19.
What is short int in C programming?
a)
The basic data type of C
b)
Qualifier
c)
Short is the qualifier and int is the basic data type
d)
All the above
20.
Programs written in few languages are executable on any machine. Such laguages are called as ___________
a)
Simple Language
b)
Structured Program
c)
Recursive Program
d)
Portable Language
21.
Group of instructions written to perform a task is called as_______.
a)
information
b)
comment
c)
array
d)
program
22.
c language has few backslash constants used for special purpose. They are also known as _________
a)
Free squence
b)
Escape sequence
c)
Exit Sequence
d)
Entry Sequence
23.
\n is a backslash constant for ________
a)
Vertical Tab space
b)
Horizontal Tab Space
c)
Form Feed
d)
New Line
24.
\t' is a backslash constant for ________
a)
Vertical Tab space
b)
Horizontal Tab Space
c)
Form Feed
d)
New Line
25.
\v is an escape sequence for _________
a)
Vertical Tab space
b)
Horizontal Tab Space
c)
Form Feed
d)
New Line
26.
\0 represents _________________
a)
Zero
b)
Null Character
c)
Division by Zero
d)
void data type
27.
As per C language standard, which of the following are not keywords? Pick the best statement.
int, when, make, elseif, sizeof
a)
when, make, elseif
b)
int, sizeof
c)
when, sizeof
d)
make, int, sizeof
28.
Each keyword is meant to perform a specific function in a C program. Keywords are also called as __________.
a)
Compiled words
b)
Reserved Words
c)
Constant Words
d)
Dumb Words
29.
Keywords are pre-defined words in a C compiler. How many keywords are in C.
a)
30
b)
31
c)
32
d)
33
30.
Keywords are pre-defined words in a C compiler. Keywords are written in ____________ case letters
a)
upper
b)
lower
c)
either lower or upper
d)
combined lower and upper
31.
Which o fthe following is a illegal variable name?
a)
update
b)
update_1
c)
Update
d)
1_update
32.
What is an array of characters, that end with a null character called?
a)
constant
b)
String
c)
Keyword
d)
Varaiable
33.
Which special symbol is used in arrays for specifying the subscript?
a)
{ }
b)
[ ]
c)
( )
d)
< >
34.
What is the problem in following variable declaration?
float 3Bedroom-Hall-Kitchen?;
a)
The variable name begins with an integer
b)
The special character ‘-‘
c)
The special character ‘?’
d)
All the above
35.
Which of the following is not a valid variable name declaration?
a)
float PI = 3.14;
b)
double PI = 3.14;
c)
int PI = 3.14;
d)
#define PI 3.14
36.
Which is valid C expression?
a)
int my_num = 100,000;
b)
int my_num = 10000;
c)
int my num = 1000;
d)
int my(num) = 10000;
37.
We want to store an integer number. Which of the following is correct statement?
a)
Integer x;
b)
int x;
c)
Int x;
d)
float x;
38.
We want to store a decimal value. Which of the following is correct statement?
a)
float x;
b)
int x;
c)
char x;
d)
float x;
39.
Data types are used to store data. Which of the datatype has no value?
a)
float
b)
int
c)
char
d)
void
40.
Integers occupy 2 bytes in 16 bit computers. How many bytes will it occupy in 32 bit computer?
a)
4
b)
8
c)
16
d)
32
41.
How many bits are there in each byte?
a)
1
b)
16
c)
8
d)
2
42.
How many bytes will float data type occupy?
a)
2
b)
4
c)
8
d)
16
43.
Float data type occupies ________ bits of memory
a)
32
b)
64
c)
16
d)
128
44.
How many bytes will char data type occupy?
a)
1
b)
2
c)
4
d)
8
45.
In 16 bit computer int data type occupies 2 bytes. What is the smallest signed integer value that can be stored?
a)
-32765
b)
-32768
c)
-32767
d)
-32766
46.
In 16 bit computer int data type occupies 2 bytes. What is the highest signed integer value that can be stored?
a)
32765
b)
32768
c)
32767
d)
32766
47.
In 16 bit computer int data type occupies 2 bytes. What is the highest value of unsigned integer value that can be stored?
a)
32767
b)
32768
c)
65535
d)
65536
48.
How many bytes will long double data type occupy?
a)
4
b)
8
c)
10
d)
16
49.
The float data type occupies 4 bytes. How many decimal precision places does it provide?
a)
8 decimal places
b)
15 decimal places
c)
10 decimal places
d)
6 decimal places
50.
The float data type gives 6 decimal places. How many decimal precision places does double data type provide?
a)
19 decimal places
b)
15 decimal places
c)
10 decimal places
d)
6 decimal places
51.
The double data type gives 15 decimal places. How many decimal precision places does long double data type provide?
a)
19 decimal places
b)
15 decimal places
c)
10 decimal places
d)
6 decimal places
52.
Format specifiers are used with printf and scanf. These specifiers start with which opeartor?
a)
$
b)
&
c)
%
d)
#
53.
Which of the following format specifier is used to represent integer data type?
a)
%f
b)
%d
c)
%ld
d)
%c
54.
Which of the following format specifier is used to represent floating point datatype?
a)
%f
b)
%d
c)
%ld
d)
%c
55.
Which of the following format specifier is used to represent double datatype?
a)
%f
b)
%lf
c)
%ld
d)
%d
56.
Which of the following format specifier is used to represent long int data type?
a)
%f
b)
%lf
c)
%ld
d)
%d
57.
Which of the following format specifier is used to represent char data type?
a)
%f
b)
%d
c)
%c
d)
%s
58.
Which of the following format specifier is used to represent string data type?
a)
%f
b)
%d
c)
%c
d)
%s
59.
Data is stored in the memory location. If the value changes during the execution of a program, then what will it be called as?
a)
constant
b)
literals
c)
identifiers
d)
variable
60.
Data is stored in the memory location. If the value does not change during the execution of a program, then what will it be called as?
a)
constant
b)
literals
c)
identifiers
d)
variable
61.
All variables declared within a block of code are automatic by default. What is the default value of an automatic variable?
a)
0
b)
garbage value
c)
1
d)
NAN
62.
What is the value stored in x if it is declared as
static int x;
a)
0
b)
garbage value
c)
1
d)
NAN
63.
What is the value stored in x if it is declared as
register int x;
a)
0
b)
garbage value
c)
1
d)
NAN
64.
What is the default value stored in x, if it is declared as
extern in x;
a)
0
b)
garbage value
c)
1
d)
NAN
65.
Which of the following is true for variable names in C?
a)
They can contain alphanumeric characters as well as special characters
b)
It is not an error to declare a variable to be one of the keywords(goto, static)
c)
Variable names cannot start with a digit
d)
Variable name can start with $
66.
Which of the following is not a valid C variable name?
a)
int number;
b)
float rate;
c)
int variable_count;
d)
int $main;
67.
We can begin name of a variable with an underscore. But it is not encouraged. Why?
a)
It is not standardized
b)
To avoid conflicts since assemblers and loaders use such names
c)
To avoid conflicts since library routines use such names
d)
To avoid conflicts with environment variables of an operating system
68.
A c program uses strrev and strcat functions. Which header file much be included?
a)
string.h
b)
ctype.h
c)
char.h
d)
stdlib.h
69.
A c program uses printf and scanf functions. Which header file much be included?
a)
stdlib.h
b)
stdio.h
c)
conio.h
d)
stdarg.h
70.
Which header file has the definitions of console input output functions such as clrscr, getch?
a)
stdlib.h
b)
stdio.h
c)
conio.h
d)
stdarg.h
71.
A c program uses isdigit and islower functions. Which header file much be included?
a)
string.h
b)
ctype.h
c)
char.h
d)
stdlib.h
72.
Which of the following is a valid definition section statement
a)
#define A=3.74
b)
#define A 3.74
c)
#define A 3.74;
d)
#define A "3.74";
73.
Single line comment starts with ______
a)
/*
b)
//
c)
*/
d)
(
74.
Comments belong to which section of the C Program?
a)
Link Section
b)
Definition Section
c)
Global Declaration Section
d)
Documentation Section
75.
Header files belong to which section of the C Program
a)
Link Section
b)
Definition Section
c)
Global Declaration Section
d)
Documentation Section
76.
Declaration and Executable part belong to whiich section of the C Program
a)
Global Declaration Section
b)
Main Function Section
c)
Definition Section
d)
Documentation Section
77.
float x = 10, y = 2;
Which of the following gives error?
a)
x = x + y
b)
x= x - y
c)
x= x * y
d)
x= x % y
78.
What will be the output of the program?
void main()
{
int i =1, 6, 9;
printf(“%d”, i);
}
a)
garbe value
b)
1
c)
Compile error
d)
9
79.
The type of operator which combines two different relational expression is ______________
a)
Logical operator
b)
Arithmetic Operator
c)
Conditional Operator
d)
Increment Operator
80.
Identify the relational operator from the following.
a)
%=
b)
=
c)
+=
d)
==
81.
What is the output of this C code?
void main()
{
int i = 5;
int k = i %4;
printf("%d\n", k);
}
a)
1
b)
-1
c)
-1.25
82.
What is the output of this C code?
void main()
{
int i = 7;
i = i / 4;
printf("%d\n", i);
}
a)
0
b)
1
c)
7
d)
4
83.
What is the output of this C code?
void main()
{
int x = 4.3 % 2;
printf("Value of x is %d", x);
}
a)
Value of x is 1.3
b)
Value of x is 2.3
c)
Value of x is 0.3
d)
Compile Time Error
84.
Which of the following data type will throw an error on modulus operation(%)?
a)
char
b)
float
c)
short
d)
int
85.
What is the output of this C code?
void main()
{
int a = 20, b = 15, c = 5;
int d;
d = a == (b + c);
printf("%d", d);
}
a)
1
b)
20
c)
40
d)
10
86.
If the variable ch contains the bit pattern 11010111, then, ch >> 1 would give _______________
a)
1101011
b)
11010100
c)
11101011
d)
1101010
87.
If the variable ch contains the bit pattern 11010111, then, ch >> 4 would give _______________
a)
1101
b)
11111111
c)
10101010
d)
111101
88.
What is stored in x?
char x = 10101011 & 11111111;
a)
10101011
b)
11111111
c)
11001100
d)
11110000
89.
What is stored in x?
char x = 10101011 | 11111111;
a)
10101011
b)
11111111
c)
11001100
d)
11110000
90.
What is stored in x?
char x = 10101011 ^ 11111111;
a)
10101011
b)
11111111
c)
11001100
d)
1010100
91.
What is stored in x?
char x = ~10101011
a)
10101011
b)
11111111
c)
1010100
d)
11001100
92.
x= 10101011 ^ 11111111; The result of this is equal to which one of the following?
a)
x = 10101011 & 11111111;
b)
x = ~10101011
c)
x = 10101011 & 11111111;
d)
x = 10101011 & 11111111;
93.
What is the value of C, if C=--2?
a)
1
b)
2
c)
-2
94.
for c = 2, value of c after c <<= 1;
a)
1
b)
2
c)
3
d)
4
95.
What value does the variable 'b' have after the following code is executed?
int a,b;
a = 1;
b = a++;
a)
1
b)
2
c)
3
d)
Undefined
96.
What value does the variable 'a' have after the following code is executed?
int a,b;
a = 1;
b = a++;
a)
1
b)
2
c)
3
d)
Undefined
97.
What value does the variable z have after the following code is executed?
int x, y, z;
x = 3;
y = 4;
z = ++x * y++;
a)
9
b)
12
c)
16
d)
20
98.
What value does the variable x have after the following code is executed?
int x, y, z;
x = 3;
y = 4;
z = x++ * y++;
a)
20
b)
12
c)
16
d)
6
99.
What value does the variable y have after the following code is executed?
int x, y, z;
x = 3;
y = 4;
z = ++x * y--;
a)
20
b)
12
c)
16
d)
6
100.
What will be the output of the program?
void main()
{
int x = 4, y, z;
y = --x;
z = x--;
printf("%d, %d, %d\n", x, y, z);
}
a)
4,3,3
b)
3,3,3
c)
2,3,3
d)
4,4,3
101.
int i = 5, j = 10;
float k = 15;
printf("%ld ", sizeof(k /= i + j));
What will be the output?
a)
4
b)
8
c)
2
d)
1
Reset
