Question Bank
How many different trees with 5 nodes, labeled with numbers from 1 to 5 exists?
10
273
32
120
125
In how many ways can we color the following graph G with three colors?
0
288
336
1874
Which of the following graphs are eulerian graphs and which ones are not?
G1 : no; G2, G3 : yes
G1 : yes; G2, G3 : no
G1, G2 : yes; G3 : no
none
all of them are eulerian
In the Internet, which is made up of interconnected physical networks of computers, each network connection of a computer is assigned an Internet address. In IPv4 Internet protocol, every Internet address is a 32-bit string, made of a network number (netid) followed by a host number (hostid). There are 3 types of Internet addresses:
(a) Class A: these are of the form:
(b) Class B: these are of the form:
(c) Class C: these are of the form:
How many different IPv4 addresses are available for the internet network connections?
In a drawer there are 8 brown socks and 12 black socks. A child picks socks from the drawer at random in the dark. How many socks must he take out to be sure that he picked at least two black socks?
3
10
14
9
How many integer numbers between 1 and 1000 are divisible with 7, but are not divisible with 3?
93
95
92
136
Consider the following weighted graph
What is the total weight of a minimum spanning tree of this graph?
229
216
230
234
Let be a simple undirected graph with nodes numbered from to , and be its adjacency matrix. What is the number of simple undirected graphs with nodes labeled from
to .
Let be the set of matrices of dimension whose elements are 0 or 1.
For every two matrices and we define the operations and as follows:
if and
if for all .
Let be a simple undirected graph with nodes numbered from to , and be its adjacency matrix.
What is the number of simple undirected graphs with n nodes labeled from to ?
Let be the set of matrices of dimension whose elements are 0 or 1.
For every two matrices and we define the operations and as follows:
if and
if for all .
Let be a simple undirected graph with nodes numbered from to , and be its adjacency matrix.
Let be the identity matrix of dimension , and .
Consider the following algorithm to compute the matrix
for to do
What is the runtime complexity of this algorithm?
Let be the set of matrices of dimension whose elements are 0 or 1.
For every two matrices and we define the operations and as follows:
if and
if for all .
Let be a simple undirected graph with nodes numbered from to , and be its adjacency matrix.
Let be the identity matrix of dimension , and .
Consider the following algorithm to compute the matrix ; for to do
Which of the following assertions holds when ?
There is a path of length at most from node to node .
There is a path of length from node to node .
There is a path from node to node which goes through node .
There is a path from node to node which goes through all nodes from the set .
What’s wrong with the sequence:
int t[N], *low=t, *mid, *high=&t[N-1];
mid = (low+high) / 2;addition of two pointers is an illegal operation
a pointer can’t be initialized with an array
the initialization of low and high is incorrect
mid can’t be initialized with a real value (when low+high is odd!)
Knowing that the . and the -> operators have equal precedence, higher than the precedence of the * operator and assuming the following declarations, which of the expressions bellow are correct?
struct point {
int x, y;
};
struct rectangle{
struct point p1, p2;
}*r[N];r[i].p1.x
r[i]->p1.x
(*r[i]).p1.x
*r[i].p1.x
Which of the following storage classes is implicit, due to the place of the variable’s declaration:
static
auto
register
extern
Can two functions, neither of whom calls the other, communicate (share data)?
no
yes, through messages
yes, through global variables
Given float x=2.5; the value of the expression 3.0*x+10/4 is:
10.0
9.5
of type double
of type float
The type of p, used in the expression p->m is:
pointer to some structure
the type of m
void *
Knowing that "0123456789" is a C string constant, which is the result of evaluating the expression: "0123456789"[i] if i=10?
the expression is syntactically wrong
undefined
′\0′
of type char
What would the value of q-p be if:
int t[20], *p=t, *q=&t[19];19
20
t[19]- t[0]
It is illegal to substract a pointer from another pointer!
What will be the value of variable a (before return) by running the following C code:
int main(){
char a, a1=200, a2=110;
a = a1 + a2;
return 0;
}a = 54
a = 310
a = 182
a = −54
What will be the value of variable “b” after execution of the following code:
unsigned char a;
int b=0; for (a=0; a<256; a++) {
b++;
}there is an infinite loop
0
256
compilation error
-1
Select the correct statement(s) regarding the following lines:
const int a = 12;
#define b 12there is no difference between const and define
the const definition will allocate space in memory
b will be processed by the preprocesor and will not appear at compilation
we cannot see in debug the constant b but we can see the constant a
Which of the following statements will generate a memory allocation:
int x
typedef int integer
struct {char x; long y; short z}
double *p
Which of the following allocations occupies more space:
int *pi
char *pc
long *pl
double **ppd
none of them (all pointers have the same amount of bytes)
What will be the output after running the following code :
int compute(int x){
static int b=20;
b--;
return b+x;
}
int main (void){
int i;
for (i=3;i>=0;i--)
printf("%d ",compute(i));
return 0;
}22 20 18 16
23 22 21 20
23 21 19 17
3 2 1 0