wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

WOMANIA PRELIMS

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

int a[] = {1, 2, 3, 4, 5};

int sum = 0;

for(int i = 0; i < 5; i++) {

if(i % 2 == 0) {

sum += *(a + i);

}

else {

sum -= *(a + i);

}

}

printf("%d", sum);

}

int main() {

solve();

return 0;

}

a)

2

b)

15

c)

Syntax error

d)

3

2.

What is the disadvantage of arrays in C?

a)

The amount of memory to be allocated should be known beforehand.

b)

Elements of an array can be accessed in constant time.

c)

Elements are stored in contiguous memory blocks.

d)

Multiple other data structures can be implemented using arrays.

3.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

int a = 3;

int res = a++ + ++a + a++ + ++a;

printf("%d", res);

}

int main() {

solve();

return 0;

}

a)

12

b)

25

c)

20

d)

18

4.

If p is an integer pointer with a value 1000, then what will the value of p + 5 be?

a)

1020

b)

1005

c)

1004

d)

1010

5.

What will be the result of the following code snippet?

#include <stdio.h>

void solve() {

char ch[10] = "abcdefghij";

int ans = 0;

for(int i = 0; i < 10; i++) {

ans += (ch[i] - 'a');

}

printf("%d", ans);

}

int main() {

solve();

return 0;

}

a)

45

b)

36

c)

20

d)

100

6.

Which of the following is not a storage class specifier in C?

a)

Volatile

b)

Extern

c)

typedef

d)

Static

7.

What kind of linked list is best to answer questions like “What is the item at position n?”

a)

Singly linked list

b)

Doubly linked list

c)

Circular linked list

d)

Array implementation of linked list

8.

Which of the following does the balancing symbols algorithm include?

a)

balancing double quotes

b)

balancing single quotes

c)

balancing operators and brackets

d)

balancing parentheses, brackets and braces

9.

Consider the graph shown below.

Which of the following edges form the MST of the given graph using Prim’a algorithm, starting from vertex 4.

a)

(4-3)(5-3)(2-3)(1-2)

b)

(4-3)(3-5)(5-1)(1-2)

c)

(4-3)(3-5)(5-2)(1-5)

d)

(4-3)(3-2)(2-1)(1-5)

10.

What will be the output of the following code?

#include<bits/stdc++.h>

using namespace std;

void func(char* str2, char* str1)

{

int m = strlen(str2);

int n = strlen(str1);

for (int i = 0; i <= n - m; i++)

{

int j;

for (j = 0; j < m; j++)

if (str1[i + j] != str2[j])

break;

if (j == m)

cout << i << endl;

}

}

int main()

{

char str1[] = "1253234";

char str2[] = "323";

func(str2, str1);

return 0;

}

a)

1

b)

2

c)

3

d)

4

11.

What is the average case time complexity of merge sort?

a)

O(n log n)

b)

O(n2)

c)

O(n2 log n)

d)

O(n log n2)

12.

Euclid’s algorithm is used for finding ___________

a)

GCD of two numbers

b)

GCD of more than three numbers

c)

LCM of two numbers

d)

LCM of more than two numbers

13.

Banker's algorithm is used

a)

To prevent deadlock

b)

To deadlock recovery

c)

To solve the deadlock

d)

None of these

14.

The size of virtual memory is based on which of the following?

a)

CPU

b)

RAM

c)

Address bus

d)

Data bus

15.

Which of the following is a condition that causes deadlock?

a)

Mutual exclusion

b)

Hold and wait

c)

Circular wait

d)

No preemption

e)

All of these

16.

In the network HTTP resources are located by

a)

uniform resource identifier

b)

unique resource locator

c)

unique resource identifier

d)

union resource locator

17.

The microprocessor of a computer can operate on any information if it is present in ______________ only.

a)

Program counter

b)

Flag

c)

Main Memory

d)

Secondary Memory

18.

Which of the following is not true about the address bus?

a)

It consists of control PIN 21 to 28

b)

It is a bidirectional bus

c)

It is 16 bits in length

d)

Lower address bus lines (AD0 – AD7) are called “Line number”

19.

Which of the following is the most commonly used data structure for implementing Dijkstra’s Algorithm?

a)

Max priority queue

b)

Stack

c)

Circular queue

d)

Min priority queue

20.

What is the time complexity of Dijikstra’s algorithm?

a)

O(N)

b)

O(N²)

c)

O(N³)

d)

O(log N)

21.

In a timeshare operating system, when the time slot assigned to a process is completed, the process switches from the current state to?

a)

Suspended state

b)

Terminated state

c)

Ready state

d)

Blocked state

22.

Each vowel of the word ADJECTIVE is substituted with the next letter of the English alphabetical series, and each consonant is substituted with the letter preceding it. How many vowels are present in the new arrangement?

a)

None

b)

One

c)

Two

d)

Three

23.

In cryptography, what is cipher?

a)

algorithm for performing encryption and decryption

b)

encrypted message

c)

both algorithm for performing encryption and decryption and encrypted message

d)

decrypted message

24.

Shift cipher is also referred to as

a)

Caesar cipher

b)

Cipher

c)

Shift cipher

d)

Cipher text

25.

A guy was writing his first book. After saving the document, he locked his laptop with a password and mentioned some phrases for the hint box.

A friend of his tried opening his laptop but found out that it was password protected. Following is the hint that appeared.

1 mobile 3 books 2 roars 1 night 4 balls 2 lighters 1 ghost 1 hat 3 watches

It seemed awkward to him. Can you help him in cracking the password?



(a)