
Code2Duo
Quiz
•
Information Technology (IT)
•
University
•
Practice Problem
•
Hard
Svethaa Lingeshwaran
FREE Resource
Enhance your content in a minute
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]]
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
ViewSonic LCD Training
Quiz
•
12th Grade - University
19 questions
CHAPTER 3: SYSTEM ANALYSIS AND DESIGN
Quiz
•
University
10 questions
Chapter 8: Developing Business IT Solutions
Quiz
•
University
20 questions
Emerging Technologies
Quiz
•
University
10 questions
SBD QUIZ#13
Quiz
•
University
12 questions
QUIZ KEJAHATAN DUNIA MAYA
Quiz
•
University
20 questions
Quiz 1 | Information Security | Kali Linux Commands
Quiz
•
University
20 questions
Quiz KTI
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
5 questions
Poetry Interpretation
Interactive video
•
4th Grade - University
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
15 questions
Review1
Quiz
•
University
15 questions
Pre1
Quiz
•
University
