Tss Mock Placement - Technical Test

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Mp_tss_july2k17
M
Mp_tss_july2k17
Community Contributor
Quizzes Created: 2 | Total Attempts: 1,917
Questions: 30 | Attempts: 170

SettingsSettingsSettings
Tss Mock Placement - Technical Test - Quiz

You will have 30 minutes to answer these 30 questions. NO NEGATIVE MARKING.
NOTE: Do not forget to mention your details.
If you have any queries, contact :
YUVRAJ SINGH (98035-53661)
KARAN SHARMA (95699-99810)


Questions and Answers
  • 1. 

    What will the function rewind() do?

    • A.

      Reposition the file pointer to a character reverse.

    • B.

      Reposition the file pointer stream to end of file.

    • C.

      Reposition the file pointer to begining of that line

    • D.

      None of these

    Correct Answer
    C. Reposition the file pointer to begining of that line
    Explanation
    The function rewind() is used to reposition the file pointer to the beginning of the file. It does not reposition the file pointer to a character reverse or to the end of the file. Therefore, the correct answer is "Reposition the file pointer to the beginning of that line."

    Rate this question:

  • 2. 

    In C, if you pass an array as an argument to a function, what actually gets passed?

    • A.

      Value of elements in array

    • B.

      First element of the array

    • C.

      Base address of the array

    • D.

      Address of the last element of array

    Correct Answer
    C. Base address of the array
    Explanation
    When you pass an array as an argument to a function in C, only the base address of the array gets passed. This means that the function will have access to the memory location where the array starts, allowing it to access and modify the elements of the array using pointer arithmetic. By having the base address, the function can effectively work with the entire array, not just the first element or the last element.

    Rate this question:

  • 3. 

    Which standard library function will you use to find the last occurance of a character in a string in C? 

    • A.

      Strnchar()

    • B.

      Strchar()

    • C.

      Strrchar()

    • D.

      Strrchr()

    Correct Answer
    D. Strrchr()
    Explanation
    The strrchr() function is the correct answer because it is a standard library function in C that is used to find the last occurrence of a character in a string. It takes two arguments - the string in which to search for the character, and the character to search for. The function returns a pointer to the last occurrence of the character in the string, or NULL if the character is not found.

    Rate this question:

  • 4. 

    What will be the size of the following structure? #include struct temp { int a[10]; char p; };

    • A.

      5

    • B.

      11

    • C.

      41

    • D.

      44

    Correct Answer
    D. 44
    Explanation
    The size of the structure is determined by the sum of the sizes of its individual members. In this case, the structure has an array of integers with a size of 10 integers, which would be 10 * sizeof(int). It also has a character variable, which has a size of sizeof(char). Therefore, the total size of the structure would be the sum of these two sizes, which is 10 * sizeof(int) + sizeof(char). Calculating this would result in the answer of 44.

    Rate this question:

  • 5. 

    What is the similarity between a structure, union and enumeration? 

    • A.

      All of them let you define new values

    • B.

      All of them let you define new data types

    • C.

       All of them let you define new pointers

    • D.

      All of them let you define new structures

    Correct Answer
    B. All of them let you define new data types
    Explanation
    All of the options mentioned - structure, union, and enumeration - allow the user to define new data types. These data types can be used to create variables that can store different kinds of values. Structures allow the user to combine different data types into a single entity, unions allow the user to define a data type that can hold different types of values at different times, and enumerations allow the user to define a set of named values for a variable. Therefore, all three options allow the user to define new data types.

    Rate this question:

  • 6. 

    What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?

    • A.

      The element will be set to 0.

    • B.

      The compiler would report an error.

    • C.

      The program may crash if some important data gets overwritten.

    • D.

      The array size would appropriately grow.

    Correct Answer
    C. The program may crash if some important data gets overwritten.
    Explanation
    If a value is assigned to an array element whose subscript exceeds the size of the array, it means that the program is accessing memory outside the bounds of the array. This can lead to overwriting important data that is stored in adjacent memory locations. As a result, the program may crash or produce unexpected behavior.

    Rate this question:

  • 7. 

    Which among the following is right? 

    • A.

      Sizeof(struct stemp*) > sizeof(union utemp*) > sizeof(char *)

    • B.

      Sizeof(struct stemp*) < sizeof(union utemp*) < sizeof(char *)

    • C.

      Sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)

    • D.

      The order Depends on the compiler

    Correct Answer
    C. Sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)
    Explanation
    The answer is "sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)". This means that the size of a pointer to a struct, a pointer to a union, and a pointer to a char are all the same. The size of a pointer depends on the architecture and the compiler being used, so it is not possible to determine the exact size without more information.

    Rate this question:

  • 8. 

    What do the following declaration signify?  char **argv;

    • A.

      Argv is a pointer to pointer.

    • B.

      Argv is a pointer to a char pointer.

    • C.

      Argv is a function pointer.

    • D.

      Argv is a member of function pointer.

    Correct Answer
    B. Argv is a pointer to a char pointer.
    Explanation
    The declaration "char **argv" signifies that "argv" is a pointer to a char pointer. This means that "argv" is a variable that stores the memory address of a pointer to a char variable. It is commonly used in C and C++ programs to store command-line arguments passed to a program.

    Rate this question:

  • 9. 

    What do the following declaration signify?  int (*pf)();

    • A.

      Pf is a pointer to function.

    • B.

      Pf is a function pointer.

    • C.

      Pf is a pointer to a function which return int

    • D.

      Pf is a function of pointer variable.

    Correct Answer
    C. Pf is a pointer to a function which return int
    Explanation
    The declaration "int (*pf)();" signifies that pf is a pointer to a function which returns an integer. This means that pf can be used to store the address of a function that returns an integer value.

    Rate this question:

  • 10. 

    What do the following declaration signify?  char *arr[10];

    • A.

      Arr is a array of 10 character pointers.

    • B.

       arr is a array of function pointer.

    • C.

      Arr is a array of characters.

    • D.

      Arr is a pointer to array of characters.

    Correct Answer
    A. Arr is a array of 10 character pointers.
    Explanation
    The declaration "char *arr[10]" signifies that arr is an array of 10 character pointers. This means that arr is a collection of 10 memory addresses, where each address points to a character value.

    Rate this question:

  • 11. 

    How will you free the memory allocated by the following program?  #include #include #define MAXROW 3 #define MAXCOL 4 int main() { int **p, i, j; p = (int **) malloc(MAXROW * sizeof(int*)); return 0; }

    • A.

      Memfree(int p);

    • B.

      Dealloc(p);

    • C.

      Malloc(p, 0);

    • D.

       free(p);

    Correct Answer
    D.  free(p);
    Explanation
    The correct answer is "free(p)". This is because the program allocates memory using the malloc() function, which dynamically allocates memory on the heap. In order to free this memory and prevent memory leaks, the free() function should be used. The argument passed to free() should be the pointer to the memory that was allocated, in this case "p". Therefore, the correct way to free the memory allocated by the program is to use the free(p) statement.

    Rate this question:

  • 12. 

    What is x in the following program? #include int main() { typedef char (*(*arrfptr[3])())[10]; arrfptr x; return 0; }

    • A.

      X is a pointer

    • B.

      X is an array of three pointer

    • C.

      X is an array of three function pointers

    • D.

      Error in x declaration

    Correct Answer
    C. X is an array of three function pointers
    Explanation
    The given program declares x as an array of three function pointers. The typedef statement creates a new type arrfptr, which is an array of three pointers to functions that return a pointer to an array of ten characters. The declaration arrfptr x; then creates an array named x of type arrfptr, which means x is an array of three function pointers.

    Rate this question:

  • 13. 

    In the following code what is 'P'?  typedef char *charp; const charp P;

    • A.

      P is a constant

    • B.

      P is a character constant

    • C.

      P is character type

    • D.

      None of the above

    Correct Answer
    A. P is a constant
    Explanation
    The code declares 'P' as a constant. The 'typedef' keyword is used to create an alias 'charp' for the type 'char *' (pointer to char). The 'const' keyword is then used to make 'P' a constant, meaning its value cannot be changed once it is assigned. Therefore, the correct answer is that 'P' is a constant.

    Rate this question:

  • 14. 

    How is search done in #include and #include "somelibrary.h" according to C standard? 

    • A.

      When former is used, current directory is searched and when latter is used, standard directory is searched

    • B.

      When former is used, standard directory is searched and when latter is used, current directory is searched

    • C.

      Hen former is used, search is done in implementation defined manner and when latter is used, current directory is searched

    • D.

      For both, search for ‘somelibrary’ is done in implementation-defined places

    Correct Answer
    D. For both, search for ‘somelibrary’ is done in implementation-defined places
    Explanation
    According to the C standard, when #include is used, the search for 'somelibrary' is done in implementation-defined places. Similarly, when #include "somelibrary.h" is used, the search is also done in implementation-defined places. Therefore, the correct answer states that the search for 'somelibrary' is done in implementation-defined places for both cases.

    Rate this question:

  • 15. 

    What is the sequence for preprocessor to look for the file within ?

    • A.

      The predefined location then the current directory

    • B.

      The current directory then the predefined location

    • C.

      The predefined location only

    • D.

      The current directory location

    Correct Answer
    A. The predefined location then the current directory
    Explanation
    The preprocessor first looks for the file in the predefined location, which is a specific location set by the system or compiler. If the file is not found in the predefined location, then the preprocessor searches for it in the current directory, which is the directory where the program is being compiled from. This sequence ensures that the preprocessor checks the commonly used and system-defined locations first before looking in the current directory.

    Rate this question:

  • 16. 

    What is stderr? 

    • A.

      Standard error

    • B.

      Standard error types

    • C.

      Standard error streams

    • D.

      Standard error definitions

    Correct Answer
    C. Standard error streams
    Explanation
    Stderr stands for standard error streams. In computer programming, it refers to the stream where error messages and diagnostic information are typically sent. It is a way for programs to communicate errors or exceptional conditions to the user or to other parts of the program. By separating the standard error stream from the standard output stream, developers can easily distinguish between regular program output and error messages, allowing for better error handling and debugging.

    Rate this question:

  • 17. 

    Input/output function prototypes and macros are defined in which header file? 

    • A.

      Conio.h

    • B.

      Stdlib.h

    • C.

      Stdio.h

    • D.

      Dos.h

    Correct Answer
    C. Stdio.h
    Explanation
    The correct answer is stdio.h. This header file contains the necessary function prototypes and macros for input/output operations in C programming language. It provides functions like printf() and scanf() for formatted output and input respectively.

    Rate this question:

  • 18. 

    What do the 'c' and 'v' in argv stands for? 

    • A.

      'c' means argument control 'v' means argument vector

    • B.

      'c' means argument count 'v' means argument vertex

    • C.

      'c' means argument count 'v' means argument vector

    • D.

      'c' means argument configuration 'v' means argument visibility

    Correct Answer
    C. 'c' means argument count 'v' means argument vector
    Explanation
    The 'c' in argv stands for argument count, which represents the number of arguments passed to the program. The 'v' stands for argument vector, which refers to an array of strings that contains the actual arguments passed to the program.

    Rate this question:

  • 19. 

    The maximum combined length of the command-line arguments including the spaces between adjacent arguments is 

    • A.

      128 characters

    • B.

      256 characters

    • C.

      67 characters

    • D.

      It may vary from one operating system to another

    Correct Answer
    D. It may vary from one operating system to another
    Explanation
    The length of command-line arguments can vary depending on the operating system. Different operating systems may have different limits on the maximum combined length of command-line arguments. Therefore, the maximum combined length of command-line arguments including the spaces between adjacent arguments may vary from one operating system to another.

    Rate this question:

  • 20. 

    What is the output of this C code?#include main(){if (sizeof(int) > -1)printf("True");elseprintf("False");}

    • A.

      True

    • B.

      Compile Time Error

    • C.

      Run Time Error

    • D.

      False

    Correct Answer
    D. False
    Explanation
    The code compares the size of the integer data type with the value -1. Since the size of the integer is always a positive value, the condition sizeof(int) > -1 will always evaluate to true. Therefore, the code will print "True". However, the given answer is "False", which contradicts the explanation. Therefore, the correct answer cannot be determined based on the given information.

    Rate this question:

  • 21. 

    What will be the output of the following program? #include #define square(x) x*x void main() { int i; i = 64/square(4); printf("%d", i); }

    • A.

      4

    • B.

      64

    • C.

      16

    • D.

      None of the mentioned

    Correct Answer
    B. 64
    Explanation
    The program defines a macro `square(x)` which calculates the square of a number. In the main function, the variable `i` is assigned the value of 64 divided by the square of 4, which is 64/16. Therefore, the value of `i` is 4. However, the program does not have a `printf` statement to print the value of `i`, so the output of the program will be nothing.

    Rate this question:

  • 22. 

    What will happen after compiling and running following code?main(){printf("%p", main);}

    • A.

      Error

    • B.

      Will make an infinite loop

    • C.

      Some address will be printed

    • D.

      None of the above

    Correct Answer
    B. Will make an infinite loop
    Explanation
    The code will not make an infinite loop. Instead, it will print the address of the main function. The code uses the printf function to print the address of the main function, which is represented by the format specifier "%p". Therefore, the correct answer is "Some address will be printed".

    Rate this question:

  • 23. 

    Any C program

    • A.

      Must contain at least one function.

    • B.

      Need not contain any function.

    • C.

      Needs input data.

    • D.

      None of the above

    Correct Answer
    A. Must contain at least one function.
    Explanation
    In the C programming language, a program must contain at least one function. A function is a block of code that performs a specific task, and it is the basic building block of a C program. Without a function, the program would not have any executable code and would not be able to perform any actions. Therefore, it is necessary for a C program to have at least one function in order to be valid and functional.

    Rate this question:

  • 24. 

    Determine output: main() { int i = abc(10); printf("%d", --i); } int abc(int i) { return(i++); }

    • A.

      10

    • B.

      9

    • C.

      11

    • D.

      None of the mentioned

    Correct Answer
    B. 9
    Explanation
    The output of the code will be 9. In the main function, the variable i is assigned the value returned by the abc function, which is 10. Then, the value of i is decremented by 1 using the pre-decrement operator (--i). Since the pre-decrement operator is used, the value of i will be decremented before it is printed using the printf function. Therefore, the output will be 9.

    Rate this question:

  • 25. 

    Determine Output: void main() { static int var = 5; printf("%d ", var--); if(var) main(); }

    • A.

      5 5 5 5 5

    • B.

      5 4 3 2 1

    • C.

      Infinite Loop

    • D.

      None of These

    Correct Answer
    B. 5 4 3 2 1
    Explanation
    The program starts by initializing a static variable "var" to 5. Then it prints the value of "var" (5) and decrements it by 1. It then checks if "var" is non-zero, which it is, so it calls the main function recursively. This process continues until "var" becomes 0. Each time the main function is called recursively, it prints the value of "var" and decrements it. Therefore, the output will be 5 4 3 2 1.

    Rate this question:

  • 26. 

    Determine the Final Output: void main() { printf("\nab"); printf("\bsi"); printf("\rha"); }

    • A.

      Absiha

    • B.

      Asiha

    • C.

      Asiha

    • D.

      Hai

    Correct Answer
    D. Hai
    Explanation
    The given code snippet is written in C programming language.

    The first line of code `printf("ab");` prints the string "ab" to the console.

    The second line of code `printf("\bsi");` uses the backspace escape sequence (\b) to move the cursor back one position, effectively erasing the last character 'b' from the previous line. It then prints the string "si" to the console.

    The third line of code `printf("\rha");` uses the carriage return escape sequence (\r) to move the cursor to the beginning of the line. It then prints the string "ha" to the console, overwriting the previous content.

    Therefore, the final output is "hai".

    Rate this question:

  • 27. 

    Let x be an array. Which of the following operations are illegal?

    • A.

      ++x

    • B.

      X+1

    • C.

       x++

    • D.

      X*2

    Correct Answer
    D. X*2
    Explanation
    The given question asks which of the operations are illegal on an array "x". The operation "x*2" is illegal because you cannot multiply an array by a scalar value. Arrays are not directly compatible with arithmetic operations like multiplication.

    Rate this question:

  • 28. 

    Determine output:void main(){int i=10;i = !i>14;printf("i=%d", i);}

    • A.

      10

    • B.

      14

    • C.

      1

    • D.

      0

    Correct Answer
    D. 0
    Explanation
    The given code snippet assigns the value of 10 to the variable 'i'. Then, it checks if the logical NOT of 'i' (which is 10) is greater than 14. Since this condition is false, the value assigned to 'i' becomes 0. Finally, the code prints the value of 'i', which is 0.

    Rate this question:

  • 29. 

    What will be output if you will compile and execute the following c code? void main(){ int i=4,x; x=++i+++i+++i; printf("%d",x); }

    • A.

      21

    • B.

      18

    • C.

      12

    • D.

      Compile Time Error

    Correct Answer
    A. 21
    Explanation
    The code uses the pre-increment operator (++i) multiple times on the same variable (i) in the same expression. According to the operator precedence rules, the rightmost ++i is evaluated first, incrementing i to 5. Then, the next ++i is evaluated, incrementing i to 6. Finally, the leftmost ++i is evaluated, incrementing i to 7. The value of i is then added three times (7+7+7) and assigned to x, resulting in x=21. Therefore, the output of the code will be 21.

    Rate this question:

  • 30. 

    What will be output if you will compile and execute the following c code? void main(){ char *str="Hello world"; printf("%d",printf("%s",str)); }

    • A.

      11Hello world

    • B.

      10Hello world

    • C.

      Hello world10

    • D.

      Hello world11

    Correct Answer
    D. Hello world11
    Explanation
    The code initializes a pointer variable `str` to point to the string "Hello world". The `printf` function is used to print the string `str`, which returns the number of characters printed. This return value is then printed using `printf` again. So, the output will be "Hello world" followed by the number of characters in the string, which is 11.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 16, 2017
    Quiz Created by
    Mp_tss_july2k17
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.