WorksheetsMCQ for Coding Carnival
Total questions: 50
Worksheet time: 33mins
Lathika is curious about who developed the Python Programming Language. Can you help her find the right answer?
Wick van Rossum
Rasmus Lerdorf
Guido van Rossum
Niene Stom
What will be the output of the following Python code?
>>>str1="helloworld"
>>>str1[::-1]
dlrowolleh
hello
world
helloworld
output for the program
prints all the even numbers between 1 and 20
prints all the odd numbers between 1 and 21
prints all the odd numbers between 1 and 20
prints all the even numbers between 1 and 21
The equivalent of the above for loop using the while syntax would be
How many times will 1 be printed
5
3
4
7
What is the order of precedence in Python?
i. Parenthesis
ii. Exponential
iii. Multiplication
iv. Division
v. Addition
vi. Subtraction
1,2,3,4,5,6
1,3,2,4,6,5
6,5,4,3,2,1
5,6,2,1,4,3
(a) is the example of comparison operator.
what will be the output of the given equation:-
a=((2*5)(3*10))/5
print(a)
(a)
What is the output of the below code snippet?
P 9
Q 10
R 2
S 6
Tuple is immutable, so it will throw an error
P 9
Q 10
R 2
S 6
T 6
None of the above
Which of the following functions can help us to find the version of python that we are currently working on?
sys.version(1)
sys.version(2)
sys.version(3)
sys.version(0)
What does the following code fragment write to the monitor?
under
over
under the limit
over the limit
Evaluate(to true or false) each of the following expressions:
(1) 14 <= 14
(2) 14 < 14
true true
true false
false false
false true
The native language of the computer is ...............?
high level language
low level
language
machine level
language
both b & c
The only fundamental language that dows not use any translator is called (a) ?
If originally x=2,y=0, and z=1, what is the value of x, y, and z after executing the following code?
if (x>y)
y=x;
else
z=x;
x=2 y=2 z=1
x=2 y=1 z=1
x=0 y=2 z=0
x=2 y=0 z=1
What will be the output of the following C code?
1
2
4
6
Directives are translated by the
(a)
What will be the output of the following code?
#include <stdio.h>
int main()
{
int *ptr, a = 10;
ptr = &a;
*ptr += 1;
printf("%d,%d/n", *ptr, a);
}
10,10
10,11
11,10
11,11
Is an algorithm used to make the programmer do more work to solve the problem?
yes
no
The visibilty modes are called as_____
modifier
accessibility
access specifier
polymorphism
PREDICT THE OUTPUT:
int x = 60;
int y = 90;
if (y%x == 0 && y-x==30)
{
System.out.println("Hello World");
}
else
{
System.out.println("Error")
}
error
hello
hello world
Hello World
Predict output for the given code snippet.
quote = 'No pain, no gain'
print(quote.islower())
false
true
char c[] = "GATE2021";
char *p =c;
printf("%s", p + p[3] - p[1]) ;
What is the output of this program?
GATE2021
2021
error
struct {
short s [10]
union {
float y;
long z;
}u;
} t;
What is the output of this program?
Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is
22 bytes
32 bytes
16 bytes
28 bytes
What is the output of the program?
int main()
{
int a = 25%10;
printf("%d", a);
return 0;
}
2.5
5
The C language is ........
A regular language
A context free language
A context sensitive language
Parsable fully only by a Turing machine
What will be the output of the following code snippet?
1.
int ch = 2;
switch(ch) {
case 1: printf("1 ");
case 2: printf("2 ");
case 3: printf("3 ");
default: printf("None"); }
2.
What will be the output of the following code snippet?
int ch = 5 ;
switch(ch) {
case 1: printf("1 ");
case 2: printf("2 ");
case 3: printf("3 ");
default: printf("None"); }
1. 2 3 None
2. Error
1. 1 2 3 None
2. None
1. 2 3 None
2. None
How many edges will a tree consisting of N nodes have?
N
N+1
N-1
N-0
What is the running time of the Huffman encoding algorithm?
O(C)
O(C log C)
O( log C)
O(N log C)
In the given graph, what is the minimum cost to travel from vertex 1 to vertex 3?
3
10
-4
-3
Which of the following can traverse the state space tree only in DFS manner?
backtracking
tracking
What will be the output of the following C code?
yes
undefined behaviour
compile time error
default
The continue statment cannot be used with (a) .
char s[ ]= "civil engineering association";
printf(s);
printf("%d",strlen(s));
civil engineering association 27
civil engineering association27
(a) is a piece of memory that can contain a data value.
The term______ originally referred to any computation performed via a set of rulesapplied to numbers written in decimal form.
algorithm
pseudocode
float
coding
What are not the Relational operators?
<=
>=
+
>
The fastest data access is provided using __________
DRAM
SRAM
Register
Cache
#include <stdio.h>
void main()
{
int i=10;
#type the loop code here
printf("%u ",i);
}
output should be infinite times
(a)
(a) functions build the abstract data type ?
Python supports _______
a . procedural programming
b . modular programming
c . object oriented programming
All of these
both b & c
both a & b
both a & c
the tuple is also known as (a) .
When the Entity Relationship Model developed ?
1967
1976
1980
1970
The Expansion for CRLF is
(a)
Which of the following is not scripting language ?
Java
PHP
Perl
HTML
The OS Module which allows you to interface with the (a) operating system.
If (a) :
print(x, "is a leap year")
for letter in range(ord('A'), ord('F')):
print(chr(letter), end=" ")
(a)
output of the program
print(I Love KEC (a) !!!)
