
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
15 questions
Bài 26

Quiz
•
10th Grade - University
10 questions
5. TRANSMISION DE DATOS NIVEL DE TRANSPORTE

Quiz
•
University
10 questions
PRF192

Quiz
•
University
15 questions
Understanding Loops in C Programming

Quiz
•
1st Grade - University
15 questions
Session 12 + 13 + 14: Searching and Sorting Algorithms

Quiz
•
University
10 questions
Java Quiz (Basics)

Quiz
•
University
10 questions
Fungsi DASPRO

Quiz
•
University
10 questions
Quiz Meet 1 Mini SC Programing

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University