WorksheetsJoy of Programming
Total questions: 50
Worksheet time: 17mins
int main()
{
float f1 = 0.1;
if (f1 == 0.1)
printf("equal\n");
else
printf("not equal\n");
}
10.0000000001
void main()
{
float x = 0.1;
printf("%d, ", x);
printf("%f", x);
}
(float)a*(int)b/(long)c * (double)d
int main()
{
int var = 010;
printf("%d", var);
}
int func()
{
return (double)(char)5.0;
}
Pick the odd man out
import
pass
break
continue
List is represented by
{ }
[ ]
( )
< >
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?
[3, 4, 5, 20, 5, 25, 1, 3]
[1, 3, 3, 4, 5, 5, 20, 25]
[3, 5, 20, 5, 25, 1, 3]
[1, 3, 4, 5, 20, 5, 25]
List is Mutable
YES
NO
A reserved keyword may not be chosen as an identifier
True
False
Which operator is called as equality operator?
- *
==
- +
=
Python ____________ holds key-value pairs.
Set
Tuple
Dictionary
List
Which keyword is use for function?
define
fun
def
function
mylist = ["apple", “Orange", "cherry"]
x = len(mylist)
What is the value of x?
2
4
1
3
List = [1, 2, 3, 1, 2, 1, 2, 3, 2, 1]
print(List.count(1))
4
3
2
1
What is a recursive function?
A function that calls other function
A function which calls itself.
Both A and B
None
List = [2.3, 4.445, 3, 5.33, 1.054, 2.5]
print(List.pop(0))
Which value will be popped out?
2.5
2.3
3
None
Which one of the following is the correct way of calling a function?
function_name()
call function_name()
ret function_name()
function function_name()
Which operator is used to perform mod operation?
%
*
+
&
Lambda is a function in python?
Yes
No
What is a variable defined outside a function referred to as?
local variable
global variable
static Variable
automatic variable
__________ is a general-purpose array-processing package
NumPy
exception
ArrayNum
NumPython
Which of the following statements is not related to list?
[ ]
unmutable
mutable
Dynamic array
Type code for Int in array concept
f
i
int
num
n = 10
sum = 0 i = 1
while i <= n:
sum = sum + i
i = i+1
print("The sum is", sum)
What is the Result?
55
45
100
200
Pick odd man out
set
tuple
list
array
The ____________ statement is a null statement
pass
asert
break
continue
The result of this program:
Friday = False
if Friday:
print "Jeans day!"
else:
print "Uniform day"
Jeans day
Today is Friday
Uniform day
Not Friday
What part of an if statement should be indented?
All of it
The statements within it
the first line
the lines within the brackets
