
Code2Duo

Quiz
•
Information Technology (IT)
•
University
•
Hard
Svethaa Lingeshwaran
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
#include <stdlib.h>
int main()
{
int *pInt;
int **ppInt1;
int **ppInt2;
pInt = (int*)malloc(sizeof(int));
ppInt1 = (int**)malloc(10*sizeof(int*));
ppInt2 = (int**)malloc(10*sizeof(int*));
free(pInt);
free(ppInt1);
free(*ppInt2);
return 0;
}
Choose the correct statement with respect to above C program.
malloc() for ppInt1 and ppInt2 isn’t correct. It’ll give compile time error.
free(*ppInt2) is not correct. It’ll give compile time error
C) free(*ppInt2) is not correct. It’ll give run time error.
) No issue with any of the malloc() and free() i.e. no compile/run time error.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following program :
print('{0:.2}'.format(1.0 / 3))
0.333333
0.33
0.333333:-2
Error
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
print(tuple[1:3] if tuple == ( 'abcd', 786 , 2.23, 'john', 70.2 ) else tuple())
( \'abcd\', 786 , 2.23, \'john\', 70.2 )
abcd
(786, 2.23)
None of the above
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Postorder traversal of a given binary search tree, T produces the following sequence of keys 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29 Which one of the following sequences of keys can be the result of an in-order traversal of the tree T?
9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95
9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29
29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95
A) 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following program that attempts to locate an element x in a sorted array a[ ] using binary search. Assume N>1. The program is erroneous. Under what conditions does the program fail?
def find(a, n, x):
i = 0
j = n
while i < j:
k = (i + j) // 2
if a[k] < x:
i = k + 1
else:
j = k
if i < len(a) and a[i] == x:
print("x is in the array")
else:
print("x is not in the array")
x is the last element of the array a[]
x is greater than all elements of the array a[]
Both of the Above
x is less than the last element of the array a[]
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Output Prediction:
What will be the output of this Python code?
def mystery(s):
return s[::-1] if len(s) % 2 == 0 else s[1::2]
print(mystery("abcdef"))
print(mystery("12345"))
fedcba and 24
abcdef and 24
fedcba and 135
fabcde and 13
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Matrix Transposition
What will be the output of the following code?
matrix = [[1, 2], [3, 4], [5, 6]]
transpose = [[row[i] for row in matrix] for i in range(2)]
print(transpose)
[[1, 3, 5], [2, 4, 6]]
[[1, 2], [3, 4], [5, 6]]
[[1, 2, 3], [4, 5, 6]]
[[1, 4], [2, 5], [3, 6]]
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
3F_14042025_Verifica per orale Informatica

Quiz
•
11th Grade - University
15 questions
แข่งขันcodingม.ต้น

Quiz
•
12th Grade - University
10 questions
Quiz Meet 2 Mini SC Programing

Quiz
•
University
16 questions
Mảng 2 chiều trong C

Quiz
•
University
14 questions
Session 17+18: String

Quiz
•
University
16 questions
Session 08: Array

Quiz
•
University
20 questions
Revissão - Linguagem C (str, fun, stru, vt+mt,)

Quiz
•
University
15 questions
Quiz Pemrograman Arduino

Quiz
•
10th Grade - University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University