Which of the following is not a data type?
A) Symbolic Data | B) Alphanumeric Data |
C) Numeric Data | D) Alphabetic Data |
Which of the following is not a data type?
A) Symbolic Data | B) Alphanumeric Data |
C) Numeric Data | D) Alphabetic Data |
*@Ac# is a type of ________________ data.
A) Symbolic | B) Alphanumeric |
C) Alphabetic | D) Numeric |
Which of the following is not a valid representation in bits?
A) 8-bit | B) 24-bit |
C) 32-bit | D) 64-bit |
What are the entities whose values can be changed called?
A) Constants | B) Variables |
C) Modules | D) Tokens |
Which of the following is not a basic data type in C language?
A) float | B) int |
C) real | D) char |
Neelam wants to share her code with a colleague, who may modify it. Thus she wants to include the date of the program creation, the author and other with the program. What component should she use?
A) header files | B) iteration |
C) comments | D) pre processor |
Which is used to convert source code to target language
A) Linker | B) Loader |
C) Executer | D) Compiler |
A 10-bit unsigned integer has the following range:
A) 0 to 1000 | B) 0 to 1024 |
C) 0 to 1023 | D) 0 to 1025 |
Tricha wants to store a list of binary data.Which of following data types should she use?
A) Boolean | B) Integer |
C) Character | D) Floating |
Which of the following options is an exception to being a part of composite data types?
A) Union | B) Structure |
C) Array | D) Stack |
What will be the final value of the res when INPUT N1=100?
Function F(INPUT N1)
Static int res=0;
IF(N1>0)
res=res+1
F(N1/20)
END IF
return res
END Function
A) 3 | B) 2 |
C) 1 | D) Error |
What will be the output of the following pseudo code
Integer x,y,z
x=2
y=1
z=5
Do
Print z--
while((x & y)|| (z+1))
End loop
A) 543210 | B) 543211 |
C) 432100 | D) 432111 |
What is the output of the following code?
Set integer _no1=0, _no2=1, _no3=1, _lower=6, _inc=1
ile _inc is less than equals to _lower:
_inc is increment by 1
Print _no3
_no3=_no1+_no2
_no1 equals to _no2
_no2 equals to _no3
End While
A) 12358 | B) 358 |
C) 112358 | D) 2358 |
Find the output of the following code
#include
t main ()
int num;
printf ("enter number" );
scanf ("%d", &num);
no = (num * 2) + 3 ;
(no & 1 && printf ("odd"))printf ("even")
return 0;
}
A) Enter a number : Odd | B) Odd |
C) Error: 'no' undeclared | D) even |
What will be the output of the following code?
#include
int main()
{
while(){
printf(“hello world”);
}
return 0;
}
A) Compile error | B) No output will be Printed |
C) hello world | D) Infinite loop |
Which among the following is the odd one out?
A) printf | B) fprintf |
C)putchar | D) scanf |
For a typical program, the input is taken using _________
A) scanf | B) Files |
C) Command-line | D) All of the mentioned |
What does the following command line signify?
prog1|prog2
A) It runs prog1 first, prog2 second | B) It runs prog2 first, prog1 second |
C) It runs both the programs, pipes output of prog1 to input of prog2 | D) It runs both the programs, pipes output of prog2 to input of prog1 |
What is the default return-type of getchar()?
A) char | B) int |
C) char * | D) reading character doesn’t require a return-type |
What is the value of EOF?
A) -1 | B) 0 |
C) 1 | D) 10 |
What will be the output of the following C code?
#include
A) scope rules | B) Compile time error due to multiple declaration |
C) Compile time error due to not defining type in statement extern i | D) Nothing will be printed as value of i is not zero because i is an automatic variable |
What will be the output of the following C code (without linking the source file in which ary1 is defined)?
#include
A) scope rules | B) Linking error due to undefined reference |
C) Compile time error because size of array is not provided | D) Compile time error because datatype of array is not provided |
What will be the output of the following C code (after linking to source file having definition of ary1)?
#include
A) Value of ary1[0]; | B) Compile time error due to multiple definition |
C) Compile time error because size of array is not provided | D) Compile time error because datatype of array is not provided |
What is the scope of an external variable?
A) Whole source file in which it is defined | B) From the point of declaration to the end of the file in which it is defined |
C) Any source file in a program | D) From the point of declaration to the end of the file being compiled |
What is the scope of a function?
A) Whole source file in which it is defined | B) From the point of declaration to the end of the file in which it is defined |
C) Any source file in a program | D) From the point of declaration to the end of the file being compiled |
What is the use of getchar()?
A) The next input character each time it is called | B) EOF when it encounters end of file |
C) The next input character each time it is called EOF when it encounters end of file | D) None of the mentioned |
Which of the following statement is true?
A) The symbolic constant EOF is defined in |
B) The value is -1 |
C) The symbolic constant EOF is defined in |
D) Only value is -1 |
What is the return value of putchar()?
A) The character written | B) EOF if an error occurs |
C)Nothing | D) Both character written & EOF if an error occurs |
Which of the following accessibility modes can be the specifier of a top level class’ ?
A) only Private | B) Protected and Private |
C) Public and Modifier | D) only no modifier |
Anu wants to make a function that is not bound to any identifier. Which of the following functions should she incorporate in her program?
A) Global Function | B) Friend Function |
C) Anonymous Function | D) Null Function |
What will be the output of the following C code?
#include
int main()
{
register int i = 10;
int *p = &i;
*p = 11;
printf("%d %d\n", i, *p);
}
A) Depends on whether i is actually stored in machine register | B) 10 10 |
C) 11 11 | D)Compile time error |
register keyword mandates compiler to place it in machine register.
A) True | B) False |
C) Depends on the standard | D)None of the mentioned |
What will be the output of the following C code?
#include
int main()
{
register static int i = 10;
i = 11;
printf("%d\n", i);
}
A) 10 | B) Compile time error |
C) Undefined behaviour | D) 11 |
What will be the output of the following C code?
#include
int main()
{
register auto int i = 10;
i = 11;
printf("%d\n", i);
}
A) 10 | B) Compile time error |
C) Undefined behaviour | D) 11 |
What will be the output of the following C code?
#include
int main()
{
register const int i = 10;
i = 11;
printf("%d\n", i);
}
A)10 | B) Compile time error |
C) Undefined behaviour | D) 11 |
Register storage class can be specified to global variables.
A) True | B) False |
C) Depends on the compiler | D) Depends on the standard |
Which among the following is wrong for “register int a;”?
A) Compiler generally ignores the request | B) You cannot take the address of this variable |
C) Access time to a is critical | D) None of the mentioned |
What will be the output of the following C code?
void main()
{
register int x = 5;
m();
printf("x is %d", x);
}
void m()
{
x++;
}
A) 6 | B) 5 |
C) Junk value | D) Compile time error |
What is the term given to the variable whose scope is beyond all the scopes i.e., it can be accessed by all the scopes?
A) Universal Variable | B) Global Variable |
C) External Variable | D) Auto Variable |
Which of the following accessibility modes can be the specifier of a top level class’ ?
A) Only Private | B) Protected and Private |
C) Public and no Modifier | D) Only no Modifier |
What does argc and argv indicate in command-line arguments? (Assuming: int main(int argc, char *argv[]) )
A) argument count, argument variable | B)argument count, argument vector |
C)argument control, argument variable | D) argument control, argument vector |
Which of the following syntax is correct for command-line arguments?
A) int main(int var, char *varg[]) |
B) int main(char *argv[], int argc) |
C) int main()
|
D) none of the mentioned |
In linux, argv[0] by command-line argument can be occupied by _________
A) ./a.out | B) ./test |
C) ./fun.out.out | D)all of the mentioned |
What type of array is generally generated in Command-line argument?
A) Single dimension array | B) 2-Dimensional Square Array |
C) Jagged Array | D)2-Dimensional Rectangular Array |
What will be the output of the following C statement? (assuming the input is “cool brother in city”)
printf(“%s\n”, argv[argc]);
A) (null) | B) City |
C) In | D) Segmentation Fault |
What is the first argument in command line arguments?
A) The number of command-line arguments the program was invoked with; | B) A pointer to an array of character strings that contain the arguments |
C) Nothing | D) None of the mentioned |
What is the second argument in command line arguments?
A) The number of command-line arguments the program was invoked with; | B) A pointer to an array of character strings that contain the arguments, one per string |
C)Nothing | D) None of the mentioned |
What is argv[0] in command line arguments?
A) The name by which the program was invoked | B) The name of the files which are passed to the program |
C) Count of the arguments in argv[] vector | D)None of the mentioned |
What argv means in command line argument ?
A) Array of Pointers | B) Pointer to a Character array |
C) Array of character Pointers | D) Array of Strings |
Which one of these is equivalent to argc ?
A) Number of Arguments | B) Number of Arguments -1 |
C) Number of Arguments +2 | D) Number of Arguments +1 |
What will the code display on compiling?
void funccall()
{
printf("this is funccall\n");
}
void main ()
{
atexit(funccall);
printf("program starts\n");
printf("program ends\n");
}
A) program starts
this is funccall program ends |
B) this is funccall
program starts program ends |
C) program starts
program ends this is funccall |
D) error |
What will be the output of the following C code?
int main ()
{
printf("starting of program\n");
printf("program exits\n");
exit(0);
printf("program ends\n");
return(0);
}
A) starting of program
program exits program ends |
B) starting of program
program exits |
C) starting of program
program ends |
D) error |
What will be the output of the following C code?
void main ()
{
char com[50];
strcpy( com, "dir" );
system(com);
}
A) error | B) lists down all the files and directories in the current directory under windows machine |
C) terminates the calling process immediately | D) calls specified function and terminates it at the end of the program |
What will be the output of the following C code?
void main()
{
div_t res;
res = div(34, 4);
printf("quotient part = %d\n", res.quot);
printf("remainder part = %d\n", res.rem);
}
A) quotient part=0
remainder part=4 |
B) quotient part=8
remainder part=2 |
C) quotient part=4
remainder part=0 |
D) quotient part=2
remainder part=8 |
Initial seed is ________ for the function srand(unsigned int seed).
A) 0 | B) 1 |
C) 00 | D) 01 |
Which statement is true with respect to RAND_MAX?
A) specifies value for status argument to exit indicating failure | B) specifies value for status argument to exit indicating success |
C) specifies maximum value returned by rand() | D) specifies maximum value returned by srand() |
Which of the given function differs from the statement’errno is not neccessarily set on conversion error’?
A) atof() | B) atoi() |
C) atol() | D) strtod() |
void free(void *p) performs which of the following functions?
A) returns pointer to allocated space for existing contents of p | B) de-allocates space to which p points |
C) to abnormally terminate the program | D) no such function defined in stdlib.h |
What will be the output of the following C code?
#include
int main()
{
int i = 0;
int x = i++, y = ++i;
printf(“%d % d\n”, x, y);
return 0;
}
A) 0, 2 | B) 0, 1 |
C) 1, 2 | D) Undefined |
What does argc and argv indicate in command-line arguments?
(Assuming: int main(int argc, char *argv[]) )
A) argument count, argument variable | B) argument count, argument vector |
C) argument control, argument variable | D) argument control, argument vector |
What will be the output of the following C code?
#include
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf("%d\n", *p);
}
A) 10 | B) Some garbage value |
C) Compile time error | D) Segmentation fault/code crash |
What will be the output of the following C code?
#include
void foo(int*);
int main()
{
int i = 10, *p = &i;
foo(p++);
}
void foo(int *p)
{
printf("%d\n", *p);
}
A) 10 | B) Some garbage value |
C) Compile time error | D) Segmentation fault/code crash |
What will be the output of the following C code?
#include
void foo(float *);
int main()
{
int i = 10, *p = &i;
foo(&i);
}
void foo(float *p)
{
printf("%f\n", *p);
}
A) 10.000000 | B) 0.000000 |
C) Compile time error | D) Undefined behaviour |
What will be the output of the following C code?
#include
int main()
{
int i = 97, *p = &i;
foo(&i);
printf("%d ", *p);
}
void foo(int *p)
{
int j = 2;
p = &j;
printf("%d ", *p);
}
A) 2 97 | B) 2 2 |
C) Compile time error | D) Segmentation fault/code crash |
What will be the output of the following C code?
#include
int main()
{
int i = 97, *p = &i;
foo(&p);
printf("%d ", *p);
return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j;
printf("%d ", **p);
}
A) 2 97 | B) 2 2 |
C) Compile time error | D) Segmentation fault/code crash |
What will be the output of the following C code?
#include
int main()
{
int i = 11;
int *p = &i;
foo(&p);
printf("%d ", *p);
}
void foo(int *const *p)
{
int j = 10;
*p = &j;
printf("%d ", **p);
}
A) Compile time error | B) 10 10 |
C) Undefined behaviour | D) 10 11 |
What will be the output of the following C code?
#include
int main()
{
int i = 10;
int *p = &i;
foo(&p);
printf("%d ", *p);
printf("%d ", *p);
}
void foo(int **const p)
{
int j = 11;
*p = &j;
printf("%d ", **p);
}
A) 11 11 11 | B) 11 11 Undefined-value |
C) Compile time error | D) Segmentation fault/code-crash |
What will be the output of the following C code?
#include
int main()
{
int i = 10;
int *const p = &i;
foo(&p);
printf("%d\n", *p);
}
void foo(int **p)
{
int j = 11;
*p = &j;
printf("%d\n", **p);
}
A) 11 11 | B) Undefined-value |
C) Compile time error | D) Segmentation fault/code-crash |
Which of the following is the correct syntax to send an array as a parameter to function?
A) func(&array); | B) func(#array); |
C) func(*array); | D) func(array[size]); |
If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
A) . | B) & |
C) * | D) -> |
Passing object to a function _______________
A) Can be done only in one way | B) Can be done in more than one ways |
C) Is not possible | D) Is not possible in OOP |
The object ________________
A) Can be passed by reference | B) Can be passed by value |
C) Can be passed by reference or value | D) Can be passed with reference |
Which symbol should be used to pass the object by reference in C++?
A) & | B) @ |
C) $ | D) $ or & |
If object is passed by value ______________
A) Copy constructor is used to copy the values into another object in the function | B) Copy constructor is used to copy the values into temporary object |
C) Reference to the object is used to access the values of the object | D) Cannot be Reference to the object is used to created new object in its place |
Pass by reference of an object to a function _______________
A) Affects the object in called function only | B) Affects the object in prototype only |
C) Affects the object in caller function | D) Affects the object only if mentioned with & symbol with every call |
Copy constructor definition requires __________________
A) Object to be passed by value | B) Object not to be passed to it |
C) Object to be passed by reference | D) Object to be passed with each data member value |
What is the type of object that should be specified in the argument list?
A) Function name | B) Object name itself |
C) Caller function name | D) Class name of object |
If an object is passed by value, _________________
A) Temporary object is used in the function | B) Local object in the function is used |
C) Only the data member values are used | D) The values are accessible from the original object |
Can data members be passed to a function using the object?
A) Yes, it can be passed only inside class functions | B) Yes, only if the data members are public and are being passed to a function outside the class |
C) No, can’t be passed outside the class | D) No, can’t be done |
What exactly is passed when an object is passed by reference?
A) The original object name | B) The original object class name |
C) The exact address of the object in memory | D) The exact address of data members |
The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ___________
A) break | B) exit(0) |
C) abort() | D) terminate |
What will be the correct syntax for running two variable for loop simultaneously?
A) for (i = 0; i < n; i++)
for (j = 0; j < n; j += 5) |
B) for (i = 0, j = 0; i < n, j < n; i++, j += 5) |
C) for (i = 0; i < n;i++){} for (j = 0; j < n;j += 5){} | D) none of the mentioned |
Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i < n; i++)?
A) for (i = n; i>0; i–) | B) for (i = n; i >= 0; i–) |
C) for (i = n-1; i>0; i–) | D) for (i = n-1; i>-1; i–) |
Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)?
A) variable | B) function |
C) typedef | D) macros |
What will be the output of the following C code?
#include
int main()
{
short i;
for (i = 1; i >= 0; i++)
printf("%d\n", i);
}
A) The control won’t fall into the for loop | B) Numbers will be displayed until the signed limit of short and throw a runtime error |
C) Numbers will be displayed until the signed limit of short and program will successfully terminate | D) This program will get into an infinite loop and keep printing numbers with no errors |
Which is a general strategy for controlling how a computation evolves?
A) Recursion | B) Mapping |
C) Iteration | D) None of the mentioned |
What will be the output of the following C code?
#include
void main()
{
int k = 0;
for (k)
printf("Hello");
}
A) Compile time error | B) hello |
C) Nothing | D) Varies |
What will be the output of the following C code?
#include
void main()
{
int k = 0;
for (k < 3; k++)
printf("Hello");
}
A) Compile time error | B) hello |
C) Nothing | D) Varies |
What will be the output of the following C code?
#include
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++)
printf("Hello");
}
A) Run time error | B) Hello is printed thrice |
C) Hello is printed twice | D) Hello is printed infinitely |
What will be the output of the following C code?
#include
void main()
{
int x = 5;
if (true);
printf(“hello”);
}
A) It will display hello | B) It will throw an error |
C) Nothing will be displayed | D) Compiler dependent |
The data structure used to implement recursive function calls _____________
A) Array | B) Linked list |
C) Binary tree | D) Stack |
What will be the output of the following C code?
#include
main()
{
int n;
n=f1(4);
printf("%d",n);
}
f1(int x)
{
int b;
if(x==1)
return 1;
else
b=x*f1(x-1);
return b;
}
A) 24 | B) 4 |
C) 12 | D) 10 |
The principle of stack is __________
A) First in first out | B) First in last out |
C) Last in first out | D) Last in last out |
In the absence of a exit condition in a recursive function, the following error is given __________
A) Compile time error | B) Run time error |
C) Logical error | D) No error |
What will be the output of the following C code?
#include
main()
{
int n,i;
n=f(6);
printf("%d",n);
}
f(int x)
{
if(x==2)
return 2;
else
{
printf("+");
f(x-1);
}
}
A) ++++2 | B) +++++2 |
C) +++++ | D) 2 |
How many times is ‘a’ printed when the following C code is executed?
#include
main()
{
int a;
a=f1(10);
printf("%d",a);
}
f1(int b)
{
if(b==0)
return 0;
else
{
printf("a");
f1(b--);
}
}
A) 9 times | B) 10 times |
C) 0 times | D) Infinite number of times |
What will be the output of the following C code?
#include
main()
{
int n=10;
int f(int n);
printf("%d",f(n));
}
int f(int n)
{
if(n>0)
return(n+f(n-2));
}
A) 10 | B) 80 |
C) 30 | D) Error |
What will be the output of the following C code?
'
#include
int main()
{
printf("Hello");
main();
return 0;
}
A) Hello is printed once | B) Hello infinite number of times |
C) Hello is not printed at all | D) 0 is returned |
What will be the output of the following C code if the input given to the code shown below is “sanfoundry”?
#include
#define NL '\n'
main()
{
void f(void);
printf("enter the word\n");
f();
}
void f(void)
{
char c;
if((c=getchar())!=NL)
{
f();
printf("%c",c);
}
return;
}
A) sanfoundry | B) infinite loop |
C) yrdnuofnas | D) fnasyrdnuo |
Iteration requires more system memory than recursion.
A) True | B) False |
Not a member yet? Register now
Are you a member? Login now