c while(1) { char *smallString = (char *) malloc(10); } c long long number = 1; while(1) number *= 2; c while(1) { char hugeString[1000000L]; memset(hugeString, 0, 1000000L); } c while(1) { long *bigArray = (long *) malloc(sizeof(long) * 1000); memset(bigArray, 1000000, 1000); free(bigArray); }
1.
c
while(1)
{
char *smallString = (char *) malloc(10);
}
2.
c
long long number = 1;
while(1)
number *= 2;
3.
c
while(1)
{
char hugeString[1000000L];
memset(hugeString, 0, 1000000L);
}
4.
c
while(1)
{
long *bigArray = (long *) malloc(sizeof(long) * 1000);
memset(bigArray, 1000000, 1000);
free(bigArray);
}
Q 1 / 47
c int f1 (int a, int b) { if (a > b) { printf("A is greater than Bn"); return 1; } else { printf("B is greater than A"); return 0; } } main() { if (f1(20,10) || f1(10,20)) printf("C is fun!n"); } A is greater then B C is fun! A is greater then B B is greater then A C is fun! A is greater then B B is greater then A
1.
A is greater then B
C is fun!
2.
A is greater then B
B is greater then A
C is fun!
3.
A is greater then B
B is greater then A
Q 2 / 47
1.
recursion
2.
subfunction
3.
inner call
4.
infinite loop
Q 3 / 47
c main(){ char c1 ='a'; char c2 = c1+10; }
1.
character arithmetic
2.
undefined assignment
3.
type conversion
4.
invalid declaration
Q 4 / 47
c float g; void *vptr=&g;
1.
f = _(float _)vptr;
2.
f = (float *)vptr;
3.
f = *(float *)vptr;
4.
f = *(float)vptr;
Q 5 / 47
c struct s { int i; struct s *s1; struct s *s2; };
1.
a node
2.
a linked list
3.
a stack
4.
a binary tree
Q 6 / 47
1.
The preprocessor will try to locate the fileA in same directory as the source file, and the fileB in a predetermined directory path.
2.
The preprocessor will try to locate the fileA in the fixed system directory. It will try to locate fileB in the directory path designated by the -l option added to the command line while compiling the source code.
3.
The file using fileA syntax must be system files, of unlimited number. fileB must be a user file at a maximun of one per source file.
4.
The preprocessor will try to locate the fileA in a predetermined directory path. It will try to locate fileB in the same directory as the source file along with a custom directory path.
Q 7 / 47
c for (int i = 0; i>=0, i--){ printf("%dn", i); }//end of loop c int i; for (i=1; i<=10; i++){ printf("%d", i); } c int i = 10; while (i>0){ printf("%dn", i); i--; } c int i; for (i= 10; i>0; i--){ printf("%dn", i); }// end of loop
1.
c
for (int i = 0; i>=0, i--){
printf("%dn", i);
}//end of loop
2.
c
int i;
for (i=1; i<=10; i++){
printf("%d", i);
}
3.
c
int i = 10;
while (i>0){
printf("%dn", i);
i--;
}
4.
c
int i;
for (i= 10; i>0; i--){
printf("%dn", i);
}// end of loop
Q 8 / 47
1.
volatile
2.
typeof
3.
register
4.
typedef
Q 9 / 47
c int main(){ int a=1, b=2, c=3, d=4; int x = a; if (a>b) if (b<c) x=b; else x=c; return(x); }
1.
1
2.
3
3.
2
4.
0
Q 10 / 47
c union Cars { char make[20]; char model[30]; short year; } car;
1.
32
2.
54
3.
30
4.
52
Q 11 / 47
c main(){ constant int PI = 3.14; printf("%fn", pi); }
1.
The value of PI needs to be set to 3.141593, not 3.14
2.
The declaration of PI needs to say const, not constant.
3.
The data type of PI needs to be float not int.
4.
The printf statement needs to use PI, not pi.
Q 12 / 47
1.
main()
2.
int main() {return 0;}
3.
main() { }
4.
main() { ; }
Q 13 / 47
1.
data type of parameters
2.
return type of function
3.
parameter names
4.
number of parameters
Q 14 / 47
1.
stdout
2.
stdio.h
3.
default.h
4.
string.h
Q 15 / 47
1.
BSS Segment
2.
stack
3.
heap
4.
data segment
Q 16 / 47
1.
dalloc()
2.
dealloc()
3.
release()
4.
free()
Q 17 / 47
1.
keywords
2.
identifiers
3.
tokens
4.
functions
Q 18 / 47
1.
during the assigment of the variable
2.
during the initialization of the variable
3.
during the declaration of the variable
4.
during the definition of the variable
Q 19 / 47
1.
by using pointers
2.
by declaring functions separately from defining them
3.
by using recursive functions
4.
by using global variables
Q 20 / 47
1.
Objects; Structure
2.
Variables; Declaration
3.
Data types; Memory location
4.
Arrays; Header file
Q 21 / 47
c main() { char c1='a' , c2='A'; int i=c2-c1; printf("%d", i); }
1.
32
2.
Runtime error
3.
-32
4.
0
Q 22 / 47
1.
The scanf() function reads data formatted as a string; The sscanf() function reads string input from the screen.
2.
The scanf() function reads formatted data from the keyboard; The sscanf() function reads formatted input from a string.
3.
The scanf() function reads string data from the keyboard; The sscanf() function reads string data from a string.
4.
The scanf() function reads formatted data from a file; The sscanf() function reads input from a selected string
Q 23 / 47
c char *string[20] = { "one", "two", "three"};
1.
`printf("%c", string[1][2]);`
2.
`printf("%s", string[1][2]);`
3.
`printf("%s", string[1]);`
4.
`printf(string[1]);`
Q 24 / 47
1.
`player.name`
2.
`(*player).name`
3.
`*player.name`
4.
`player.*name`
Q 25 / 47
c main() { for(i=0; i<10; i++) ; } c main() { int i=0; for(; i<10; i++) ; } c main() { int i; for(i=0; i<j; i++) ; } c main() { int i; for (i= 10; i<10; i++) }
1.
c
main() {
for(i=0; i<10; i++) ;
}
2.
c
main() {
int i=0;
for(; i<10; i++) ;
}
3.
c
main() {
int i;
for(i=0; i<j; i++) ;
}
4.
c
main() {
int i;
for (i= 10; i<10; i++)
}
Q 26 / 47
c 1 main() { float x = f1(10, 5); } 2 float f1(int a, int b) { return (a/b); }
1.
2
2.
2.000000
3.
a runtime error
4.
a compiler error
Q 27 / 47
c #include <stdio.h> int main() { int *p = NULL; return 0; }
1.
a runtime error
2.
a NULL pointer
3.
a compile error
4.
a void pointer
Q 28 / 47
1.
There is no equivalent.
2.
x->y
3.
*x->y
4.
y->x
Q 29 / 47
1.
in declarations and definitions
2.
in functions and expressions
3.
in syntax and semantics
4.
in objects and statements
Q 30 / 47
1.
in Unix
2.
in C++
3.
in C#
4.
in DOS
Q 31 / 47
1.
0 if str1 and str2 are the same, a negative number if str1 is less than str2, a positive number if str1 is greater than str2
2.
true (1) if str1 and str2 are the same, false (0) if str1 and str2 are not the same
3.
true (1) if str1 and str2 are the same, NULL if str1 and str2 are not the same
4.
0 if str1 and str2 are the same, a negative number if str2 is less than str1, a positive number if str2 is greater than str1
Q 32 / 47
c int a=10, b=20; int f1(a) { return(a*b); } main() { printf("%d", f1(5)); }
1.
100
2.
200
3.
5
4.
50
Q 33 / 47
1.
`char *string = "Hello World";`
2.
`char string = "Hello World";`
3.
`char string[20
4.
`char string[
Q 34 / 47
c #ifdef MYLIB_H #undef MYLIB_H // mylib.h content #endif /* MYLIB_H */ c #ifndef MYLIB_H #define MYLIB_H // mylib.h content #endif /* MYLIB_H */ c #define MYLIB_H #include "mylib.h" #undef MYLIB_H c #ifdef MYLIB_H #define MYLIB_H // mylib.h content #endif /* MYLIB_H */
1.
c
#ifdef MYLIB_H
#undef MYLIB_H
// mylib.h content
#endif /* MYLIB_H */
2.
c
#ifndef MYLIB_H
#define MYLIB_H
// mylib.h content
#endif /* MYLIB_H */
3.
c
#define MYLIB_H
#include "mylib.h"
#undef MYLIB_H
4.
c
#ifdef MYLIB_H
#define MYLIB_H
// mylib.h content
#endif /* MYLIB_H */
Q 35 / 47
c main(){ int x=1; while(x++<100){ x*=x; if(x<10) continue; if(x>50) break } }
1.
100
2.
3
3.
5
4.
50
Q 36 / 47
1.
syntax-driven components
2.
native interfaces
3.
system objects
4.
function calls
Q 37 / 47
1.
Pre-processor
2.
Compiler
3.
Linker
4.
Editor
Q 38 / 47
1.
do...while
2.
for...in
3.
repeat...until
4.
do...until
Q 39 / 47
1.
global
2.
static
3.
library
4.
system
Q 40 / 47
c struct a { void *f1; }; c struct a { void (*f1)(); }; c struct a { *(void *f1)(); }; c struct a { void *f1(); };
1.
c
struct a {
void *f1;
};
2.
c
struct a {
void (*f1)();
};
3.
c
struct a {
*(void *f1)();
};
4.
c
struct a {
void *f1();
};
Q 41 / 47
1.
FIFO
2.
LIFO
3.
LILO
4.
LOLI
Q 42 / 47
c main(){ char *p = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int i; for (i=0;i<5;i++) *p++; *p++; printf("%c",*p++); }
1.
K
2.
M
3.
H
4.
G
Q 43 / 47
1.
An lvalue may appear only on the left-hand side of an assignment; an rvalue may appear only on the right-hand side.
2.
An lvalue may appear only on the left-hand side of an assignment; an rvalue may appear on either the left-hand or right-hand side.
3.
An lvaue and an rvalue may appear on either left-hand or right-hand side of an assignment.
4.
An lvalue may appear on the left-hand or right-hand side of an assignment; an rvalue may appear only on the right-hand side.
Q 44 / 47
1.
`%`
2.
`**`
3.
`*`
4.
`&`
Q 45 / 47
c void add (int a, int b, int *result) { *result = a+b; } main() { int a = 10; int b = 20; int result = 0; add(a,b,&result); } c void add (int a, int b, int result) { result = a+b; } main() { int a = 10; int b = 20; int result = 0; add(a,b,result); } c void add (int a, int b, int *result) { result = a+b; } main() { int a = 10; int b = 20; int result = 0; add(a,b,result); } c void add (int *a, int *b, int *result) { result = a+b; } main() { int a = 10; int b = 20; int result = 0; add(*a,*b,*result); }
1.
c
void add (int a, int b, int *result)
{
*result = a+b;
}
main()
{
int a = 10;
int b = 20;
int result = 0;
add(a,b,&result);
}
2.
c
void add (int a, int b, int result)
{
result = a+b;
}
main()
{
int a = 10;
int b = 20;
int result = 0;
add(a,b,result);
}
3.
c
void add (int a, int b, int *result)
{
result = a+b;
}
main()
{
int a = 10;
int b = 20;
int result = 0;
add(a,b,result);
}
4.
c
void add (int *a, int *b, int *result)
{
result = a+b;
}
main()
{
int a = 10;
int b = 20;
int result = 0;
add(*a,*b,*result);
}
Q 46 / 47
c void fibonacci(int a, int b) { int c = a+b; if(a>100) return; printf("%d", a); fibonacci(a,b); } int main() { fibonacci(0,1); } c void fibonacci(int a, int b) { int c = a+b; if(a>100) return; printf("%d", b); fibonacci(a,c); } int main() { fibonacci(0,1); } c void fibonacci(int a, int b) { int c = a+b; if(a>100) return; printf("%d", a); fibonacci(b,c); } int main() { fibonacci(0,1); } c void fibonacci(int a, int b) { int c = a+b; if(a>100) return; printf("%d", c); fibonacci(b,c); } int main() { fibonacci(0,1); }
1.
c
void fibonacci(int a, int b)
{
int c = a+b;
if(a>100)
return;
printf("%d", a);
fibonacci(a,b);
}
int main()
{
fibonacci(0,1);
}
2.
c
void fibonacci(int a, int b)
{
int c = a+b;
if(a>100)
return;
printf("%d", b);
fibonacci(a,c);
}
int main()
{
fibonacci(0,1);
}
3.
c
void fibonacci(int a, int b)
{
int c = a+b;
if(a>100)
return;
printf("%d", a);
fibonacci(b,c);
}
int main()
{
fibonacci(0,1);
}
4.
c
void fibonacci(int a, int b)
{
int c = a+b;
if(a>100)
return;
printf("%d", c);
fibonacci(b,c);
}
int main()
{
fibonacci(0,1);
}
Q 47 / 47