PLASMA 2K23 HACKATHON
SECTION A
1. #include <stdio.h>
// Assume base address of "PlasmaQuiz" to be 1000
int main()
{
printf(6 + "PLasmaQuiz");
return 0;
}
a. PlasmaQuiz c. 1006
b. Quiz d. Compile-time error
2. #include <stdio.h>
int main()
{
int i = 3;
printf("%d", (++i)++);
return 0;
}
a. 3 c. 5
b. 4 d. Compile-time error
3. struct
{
short s[5];
union
{
float y;
long z;
}u;
}t;
a. 22 bytes c. 18 bytes
b. 14 bytes d. 10 bytes
4. In C, parameters are always
a. Passed by value
b. Passed by reference
c. Non pointer variables are passed by value and pointers are passed by reference
d. Passed by value result
5. Which of the following is true about return type of functions in C?
a. Functions can return any type
b. Functions can return any type except array and functions
c. Functions can return any type except array, functions and union
d. Functions can return any type except array, functions, function pointer and
union
6. Which file is generated after pre-processing of a C program?
a. .p c. .o
b. .i d. .m
Dept. ECE, JNNCE, Shimoga Page 1 of 9
PLASMA 2K23 HACKATHON
7. Which of the following is true
a. gets() doesn't do any array bound testing and should not be used.
b. fgets() should be used in place of gets() only for files, otherwise gets() is fine
c. gets() cannot read strings with spaces
d. None of the above
8. Which of the following operators can be applied on structure variables?
a. Equality comparison ( == )
b. Assignment ( = )
c. Both of the above
d. None of the above
9. Assume that a character takes 1 byte. Output of following program?
#include<stdio.h>
int main()
{
char str[20] = "JNNCEQuiz";
printf ("%d", sizeof(str));
return 0;
}
a. 9 c. 20
b. 10 d. Garbage value
10. What will be the output of the following code:
print type(type(int))
a. type ‘int’ c. Error
b. type ‘type’ d. 0
11. #include <stdio.h>
int main()
{
unsigned int i = 65000;
while (i++ != 0);
printf("%d", i);
return 0;
}
a. Infinite loop c. Run time error
b. 0 d. 1
12. If n has 3, then the statement a[++n]=n++;
a. assigns 3 to a[5]
b. assigns 4 to a[5]
c. assigns 4 to a[4]
d. What is assigned is compiler dependent
13.The following statement in ‘C’
int (*f())[ ];
declares
a. a function returning a pointer to an array of integers.
b. a function returning an array of pointers to integers.
c. array of functions returning pointers to integers.
d. an illegal statement.
Dept. ECE, JNNCE, Shimoga Page 2 of 9
PLASMA 2K23 HACKATHON
14.Given that x = 7.5, j = -1.0, n = 1.0, m = 2.0 the value of --x + j == x>n> = m is:
a. 0 c. 2
b. 1 d. 3
15. Consider the following pseudocode:
x=1;
i=1;
while (x ≤ 500)
begin
x=2X;
i=i+1;
end
What is the value of i at the end of the pseudocode?
a. 4 c. 6
b. 5 d. 7
16. A one dimensional array A has indices 1....75. Each element is a string and takes up three
memory words. The array is stored at location 1120 decimal. The starting address of A[49] is
a. 1267 c. 1264
b. 1164 d. 1169
17. #include <stdio.h>
int tmp=20;
main()
{
printf(“%d”,tmp);
func();
printf(“%d”,tmp);
}
func()
{
static int tmp=10;
printf(“%d”,tmp);
}
a. 20 10 10 c. 20 20 20
b. 20 10 20 d. 10 10 10
Dept. ECE, JNNCE, Shimoga Page 3 of 9
PLASMA 2K23 HACKATHON
18. Python supports the creation of anonymous functions at runtime, using a construct called
a. pi c. lambda
b. anonymous d. none of mentioned
19. What are the values of the following Python expressions?
2*(3*2)
(2**3)**2
2*3*2
a. 512, 64, 512 c. 64, 512, 64
b. 512, 512, 512 d. 64, 64, 64
20. What is the order of namespaces in which Python looks for an identifier?
a. Python first searches the built-in namespace, then the global namespace and finally
the local namespace
b. Python first searches the built-in namespace, then the local namespace and finally
the global namespace
c. Python first searches the local namespace, then the global namespace and finally the
built-in namespace
d. Python first searches the global namespace, then the local namespace and finally the
built-in namespace
21. What will be the output of the following Python statement?
>>>"a"+"bc"
a. bc c. a
b. abc d. bca
22. What will be the value of ‘result’ in following Python program?
list1 = [1,2,3,4]
list2 = [2,4,5,6]
list3 = [2,6,7,8]
result = list()
result.extend(i for i in list1 if i not in (list2+list3) and i not in result)
result.extend(i for i in list2 if i not in (list1+list3) and i not in result)
result.extend(i for i in list3 if i not in (list1+list2) and i not in result)
a. [1, 3, 5, 7, 8] c. [1, 2, 4, 7, 8]
b. [1, 7, 8] d. Error
Dept. ECE, JNNCE, Shimoga Page 4 of 9
PLASMA 2K23 HACKATHON
23. What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
print(i)
a. Error c. a b c d
b. 1 2 3 4 d. 0 1 2 3
24. a=’python’
b=[1,2,3]
s=(a,b)
print(s[1][1:])=?
a. [2,3] c. [1,2,3]
b. [1,2] d. none of the above
25. Which of the following types of loops are not supported in python?
a. for c. do - while
b. while d. none of the above
26. Which of the following statements is correct in this python code?
class Name:
def _init_(javatpoint):
javajavatpoint = java
name1=Name("ABC")
name2=name1
a. It will throw the error as multiple references to the same object is not possible
b. id(name1) and id(name2) will have same value
c. Both name1 and name2 will have reference to two different objects of class Name
d. All of the above
27. Study the following statements:
>>> print(0xA + 0xB + 0xC)
What will be the output of this statement?
a. 33 c. 0xA + 0xB + 0xC
b. 63 d. None of these
Dept. ECE, JNNCE, Shimoga Page 5 of 9
PLASMA 2K23 HACKATHON
28. Study the following program:
z = "xyz"
j = "j"
while j in z:
print(j, end=" ")
What will be the output of this statement?
a. xyz c. x y z
b. No output d. j j j j j j j..
29. What is the output of the following program :
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
a. 0120 c. Error
b. 012 d. None of the above
30. Given a string s =”Welcome”, which of the following code is incorrect?
a. print s[0] c. s[1]=’r’
b. print s.lower() d. print s.strip()
Dept. ECE, JNNCE, Shimoga Page 6 of 9
PLASMA 2K23 HACKATHON
SECTION B
1. #include<stdio.h>
void main()
{
if(condition)
printf(“Hello”);
else
printf(“world”);
}
What should be the condition so that output is Hello world?
2. What is the output of the following code?
#include<stdio.h>
void main()
{
int i,j;
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
if(i==j)
continue;
printf(“%d %d”,i,j);
}
}
}
3. What is the value of x and y?
#include<stdio.h>
int main()
{
int x=10,y=20;
if(x==y);
printf(“%d%d”,x,y);
return 0;
}
Dept. ECE, JNNCE, Shimoga Page 7 of 9
PLASMA 2K23 HACKATHON
4. What is the output of the following code?
#include<stdio.h>
int main()
Static int count=5;
printf(“count=%d\n”,count--);
if(count!=0)
main();
return 0;
5. What is the output of the following code?
#include<stdio.h>
int i=0;
void val();
int main()
printf(“main’s i=%d\n”,i);
i++;
val();
printf(“main’s i=%d\n”,i);
val();
return 0;
void val()
{ i=100;
printf(“val’s i=%d\n”,i);
i++;
Dept. ECE, JNNCE, Shimoga Page 8 of 9
PLASMA 2K23 HACKATHON
6. What will be the output of the following code snippet?
a = [1,2]
print(a*3)
7. What will be the output of the following code snippet?
from math import *
a = 2.19
b = 3.9999999
c = -3.30
print(int(a), floor(b), ceil(c), fabs(c))
8. What will be the output of the following code snippet?
def func( ):
global value
value = “Local”
value = “Global”
func( )
print(value)
9. Study the following function:
import math
abs(math.sqrt(36))
What will be the output of this code?
10. What is the output of the last line of the python program
>>> x = [1,2,’cat’.’dog’]
>>> x[2:2]=[3,4,5]
>>> x
Dept. ECE, JNNCE, Shimoga Page 9 of 9