-
The following symbol may be(in certain circumstances) taken as an equivalent of:
:>
- a tilde
- a parenthesis
- a bracket
- a hash
-
The regular IP address consists of:
- 4 octets
- 2 octets
- 1 octets
- 8 octets
-
Resolving a host’s name based on given IP address can be done by invoking:
get IP()
getservbyname()
gethostbyname()
getIPaddr()
-
Select the true statement:
- a variable may be
const
and volatile
at the same time
- a
const
– volatile
variable may be explicitly modified in the code containing its declaration
- a
const
– volatile
variable must not be implicitly modified by the background process
- a compiler will try to store the
const
– volatile
variable in CPU registers
-
The string literal passed to _Pragma
keyword is the subject of:
- deliteration
- dereferencing
- defragmentation
- destringization
-
The following snippet:
int f(int i){
i++;
if( i == 0) goto go_to;
retrun i;
}
int main(void) {
f(0);
go_to:
return 0;
}
- is fully correct
- will cause compilation error
- will cause infinite loop
- will cause runtime error
-
The “endline translation” occurs when the fine is opened with o_TEXT
flag and takes place during:
lseek()
function invocation
- reads only
- writes only
- reads and writes
-
The _Bool
keyword, introduced by C11, denotes a type being an equivalent of:
- unsigned
char
- boolean
void
- unsigned
int
-
A variable function is a function which:
- changes its name during program execution
- accepts more than one invocation at a time
- changes its address during program execution
- accepts varying number of arguments
-
A working process if identified by:
- name of program used to start the process
- user’s name
- source device
- its unique PID
-
The exec()
family functions:
- return to invoker in case of success
- never return to invoker
- return to invoker in case of error
- always return to invoker
-
The spawn()
family functions:
- never return to invoker
- return to invoker in case of error
- return to invoker in case of success
- always return to invoker
-
What is the expected output of the following code?
#include <stdarg.h>
#include <stdio.h>
int f(int n,...){
va_list list;
va_start(list, n);
char c;
while(va_arg(list,int)!=0)
c = va_arg(list, int);
va_end(list);
return c;
}
int main(void){
printf("[%c]\n", f('a','b','c','\0'));
return 0;
}
-
The following symbol may be (in certain circumstances) taken as an equivalent of:
??'
- a hash
- a tilde
- a caret
- a parenthesis
-
Assuming that the code was compiled and ran in Unix/Linux environment what is its expected output?
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
int x = 0;
int main(void){
if(fork()){
wait(NULL);
printf("%d", x);
return 0;
}eles {
x++;
return 0;
}
}
-
Which of the expressions can be used to discover that read()
invocation reached end of file?
read(fd, t, sizeof(t)) > 0
read(fd, t, sizeof(t)) == 0
read(fd, t, sizeof(t)) < 0
read(fd, t, sizeof(t)) == sizeof(t)
-
What is possible output of the following program?
#include <stdio.h>
int main(int argc, char * argv[]) {
puts(*argv);
return 0;
}
- an empty
- zero
- a line containing program name
- a random string
-
The volatile
specifier:
- is obsolete
- forces the compiler to fetch the variable from memory each time it is read
- tells the compiler to not use the variable
- suggest the compiler to store the variable in one of CPU registers
-
The file descriptor of value equal to 1
:
- is connected to
stdout
- is connected to
stderr
- is not connected and may be freely used
- is connected to
stdin
-
What is the expected output of the following code?
#include <string.h>
#include <stdio.h>
int main(void) {
char p[] = "10101", *q;
int i = 0;
q = strtok(p, "0");
while(q) {
i++;
q = strtok(NULL, "0");
}
printf("%d\n", i);
return 0;
}
3
2
- the code fails in an infinitive loop
1
-
What should be placed instead of <?>
to make the following snippet work properly?
if(<?> access("input", W_OK)) {
puts("File could not be written");
exit(1);
}
-
The memory block allocated by malloc()
function:
- is filled with zeros
- is filled with
0xFF
- is filled with
0xdeadbeef
- is filled with random values
-
The ellipsis (...
) used in a function header, may be:
- the first element on parameters list
- the only element on parameters list
- surrounded by brackets
- preceded by parameter of pointer type
-
The UDP protocol:
- provides reliable communication channel
- does not provide any communication channel
- is only able to transmit datagrams
- provides unreliable communication channel
-
The shortest part of a double value is:
- exponent
- significand
- sign
- all parts have equal sizes
-
Removing the letter ‘f
‘ from both literals used in the following expression:
- will change the value printed to
stdout
- won’t change the value printed to
stdout
- will cause runtime error
- will make the expression syntactically incorrect
-
The GMP library uses the mpf_t
type to represent:
- multiprecision float
- mulitprecision double vales
- mulitprecision rational values
- mulitprecision integer values
-
The wcscpy()
function is
- not a member of any standard library
- a “wide” version of
strcpy()
- used to invoke C# programs
- used to invoke Python programs
-
The result of the following expression:
int n = '9' - '1';
- is always
8
- depends on encoding system used by specific hardware platform
- is always
6
- is always
7
-
The setjmp()
function performs its return sequence:
- usually twice
- not more than once
- always once
- more than twice
-
The following snippet:
int const v 1;
int const * const p = &v;
- is fully correct
- may cause runtime error
- will cause compiler error
- may cause compiler warning
-
The FP_SUBNORMAL
flag marks a float value that:
- has been successfully normalized
- cannot be normalized
- exceeds any of IEEE defines limits
- has to be normalized
-
The so-called “network order” is identical to:
- little-endian order
- big-endian order
- target hardware platform order
- native hardware platform order
-
To store UNICODE code points the UTF-8 uses:
- 32 bits
- 16 bits
- 8 bits
- varying number of bits
-
The “st_dev
” filed of “struct stat
” in MS Windows environment reflects:
- 32 bit long device identifier
- the drive number
- device location
- device vendor’s name
-
The normalized float value:
- has the highest exponent’s bit set to
0
- has the highest significand’s bit set to
1
- has the highest significand’s bit set to
0
- has the highest exponent’s bit set to
0
-
The following declarator declarations the fun symbol as:
void (*fun) (int *, int*);
- a void pointer
- a pointer to function returning void
- a pointer to vid
- a pointer to function return pointer to void
-
According to C11 standard, the __func__
symbol is a:
- parameterless function
- parameterless macro
- global variable
- parameterized macro
-
Which of the following statements is true?
- both trigraphs and digraphs are recognized inside string literals
- trigraphs are recognized inside string literals, digraphs aren’t
- trigraphs are not recognized inside string literals, digraphs are
- both trigraphs and digraphs are not recognized inside string literals
-
Which of the following main()
function’s header is not valid?
int main(int argc, char *argv[], char ***env[])
int main(inti argc, char *argv[], char **env)
int main(int argc, char * argv[])
int main(int argc, char * argv[], char * env[])
-
The MSG_PEEK
flag is used in connection with:
bind()
recvfrom()
socket()
accept()
-
Which of the following is a proper bind()
function header?
int bind(int sockfd, struct sockaddr * addr, socklen_t * addrlen);
int bind(int sockfd, struct sockaddr addr, socklen_t * addrlen);
int bind(int sockfd, struct sockaddr addr, socklen_t addrlen);
int bind(int sockfd, struct sockaddr * addr, socklen_t addrlen);
-
What is the expected output of the following code ?
#include <string.h>
#include <stdio.h>
int main(void) {
int i, *p = &i;
printf("%d\n", memcmp(&i, &p, 4));
return 0;
}
- a number most probably different from zero
- a number always greater than zero
- the output is unpredictable
- a number always less than zero
-
Which of the given example is contemporary equivalent of the obsolete function declaration?
void f(x) float x; {return x * x;}
void f() float x; {return x * x;}
float f(float x) {return x * x;}
void f(x) float; {return x * x;}
void f(float) x; { return x * x;}
-
Using Winsock, comparing to the BSD sockets:
- requires some addition initializations
- requires some additional initializations and terminations
- is exactly the same
- requires some addition terminations
-
The length of a double typed variable:
- is define by the “C” language standards
- is hardware dependent
- is user defined
- is defined by IEEE754 standard
-
Each invocation of va_start()
must be matched by:
- exactly one matching
va_end()
invocation
- at least one matching
va_end()
invocation
- not more than one matching
va_end()
invocation
- not more than two matching
va_end()
invocation
-
The value of the following expression:
sizeof(wint_t) < sizeof(wchar_t)
- is always
1
- is always
0
- depends on target platform
- cannot be determined
-
In the argument passing convention named “stdcall”
- the invoker cleans the stack after return
- the invoker cleans the stack before return
- the stack cleans its state itself
- the stack is cleaned periodically by OS
-
A macro named va_arg
, comes from:
<vargs.h>
<stdarg.h>
<varg.h>
<args.h>