Programming Languages: Delphi, C, and Java
A mixed quiz covering concepts from Delphi/Pascal, C programming, and Java including components, memory management, operators, pointers, and GUI programming
Questions
Default layout for frame
- Flow Layout
- GridLayout
- Card Layout
- BorderLayout
- GridBagLayout
Check whether the syntax of the piece of code is correct: text.setBackGround(color.Yellow);
- True
- False
Code: FILE *f = fopen( fileName, "r" ); readData( f ); if( ???? ) { puts( "End of file was reached" ); } Which one of the following can replace the ???? in the code above to determine if the end of a file has been reached?
- f == EOF
- feof( f )
- eof( f )
- f == NULL
Which one of the following statements allocates enough space to hold an array of 10 integers that are initialized to 0?
- int *ptr = (int *) malloc(10, sizeof(int));
- int *ptr = (int *) calloc(10, sizeof(int));
- int *ptr = (int ) malloc(10sizeof(int));
- int *ptr = (int ) alloc(10sizeof(int));
Which one of the following C operators is right associative?
- =
- ,
- []
- ->
Code: #include <stdio.h> int i; void increment( int i ) { i++; } int main() { for( i = 0; i < 10; increment( i ) ) { } printf("i=%d\n", i); return 0; } What will happen when the program above is compiled and executed?
- It will not compile.
- It will print out: i=9.
- It will print out: i=10.
- It will loop indefinitely
char ** array [12][12][12]; Consider array, defined above. Which one of the following definitions and initializations of p is valid?
- char ** (* p) [12][12] = array;
- char ***** p = array;
- char * (* p) [12][12][12] = array;
- const char ** p [12][12][12] = array;
Code: char *ptr; char myString[] = "abcdefg"; ptr = myString; ptr += 5; What string does ptr point to in the sample code above?
- efg
- cdefg
- fg
- None of the above
time_t t; Which one of the following statements will properly initialize the variable t with the current time from the sample above
- t = ctime();
- time( &t );
- t = localtime();
- t = clock();
Code: char* myFunc (char *ptr) { ptr += 3; return (ptr); } int main() { char *x, *y; x = "HELLO"; y = myFunc (x); printf ("y = %s \n", y); return 0; } What will print when the sample code above is executed?
- y = LLO
- y = LO
- y = ELLO
- y = HELLO
int z,x=5,y=-10,a=4,b=2; z = x++ - --y * b / a; What number will z in the sample code above contain?
- 12
- 10
- 11
- 6
What number is equivalent to -4e3?
- -400
- .004
- -4000
- .0004
Which one of the following is not written in Delphi?
- Skype
- Toad
- PL/SQL Developer
- MySQL
- MySQL Administrator
Find out the odd one.
- Embarcadero
- CodeGear
- Inprise
- Borland
- Pascal
Which compiler directive controls whether the reserved word 'string' represents a short string or a long string?
- $M+/-
- $H+/-
- $P+/-
- $V+/-
- $X+/-
Ultimate base class of all Objects and Components.
- TObect
- TUnknown
- IUnknown
- TBase
- TComponent
Components can only be allocated on the -----
- Stack
- Heap
- Register
- Floppy
- Compact Disk
Property can be pass as a var parameters. Judge the statement.
- TRUE
- True using pointer
- FALSE
- Some times true, some times false.
What is the ordinal value of 'nodefault' storage specifier of a property?
- 2147483647
- -2147483647
- 0
- 2147483648
- -1
TButton caption can be left aligned. Judge the comment.
- TRUE
- FALSE
- True with the help of changing the Bidi alignment.
- True by setting proper margin value.