Total Pageviews

Showing posts with label tcs. Show all posts
Showing posts with label tcs. Show all posts

TCS, Qualcomm launch innovation hub in Hyderabad to build AI, IoT, 5G solutions

The hub will utilise TCS’ expertise in digital technologies, along with Qualcomm Technologies’ depth in 5G, edge AI and edge devices to build solutions to entirely new use-cases, TCS said in a statement.

from Blogger http://rvakr.blogspot.com/2019/11/tcs-qualcomm-launch-innovation-hub-in.html
via SEO Services

TCS PROGRAM LOGIC Level 2





11.&Sh#$J is a type of ________________ data.
  1. Symbolic
  2. Alphanumeric
  3. Alphabetic
  4. Numeric

Answer
Answer : 1
Explanation : Any data that has symbols should ideally be symbolic data. But, there's no data type as 'symbolic data'. So any combination having symbols and alphabetic/numeric data, will be considered as alphanumeric.


12.Which line of the code is having error in the following program?
#include
int main()
{
  char ch = 'D';
  float flt = 7.823;
  int intgr = 150;
  double dbl = 56.243917;
  printf("Character is %c \n", ch);
  printf("Float value is %f \n", flt);
  printf("Integer value is %i\n" , intgr);
  printf("Double value is %lf \n", dbl);
  return 0;
}

  1. printf("Float value is %f \n", flt)
  2. double dbl = 56.243917;
  3. printf("Double value is %lf \n", dbl);
  4. printf("Integer value is %i\n" , intgr);

Answer
Answer : 4
Explanation : The error with the line of code is that it uses "%i" as format specifier instead of "%d".

13.Which of these is used for generating a newline in the output?
  1. \t
  2. \n
  3. \b
  4. \l

Answer
Answer : 2
Explanation : \n is used to generate new lines in the output.


14.What will be the output of the following program?
#include
int main()
{
  int count=9;
  printf("count \n");
  printf("%d",count);
}

  1. 9
    9
  2. count
    %d
  3. 9
    %d
  4. count
    9

Answer
Answer : 4
Explanation : When you write count inside double quotes, the word itself gets printed in the output. And when count is outside the double quotes, and the double quotes has the format specifier %d, it seeks the value of the variable "count". Hence the output is: count
9


15.Which of the following statements is/are correct?
  1. The value stored in the CPU register can always be accessed faster than that stored in memory
  2. A register storage class variable will always be stored in a CPU register
  3. Both the statements are correct
  4. None of the statements is correct
Answer Answer : 1
Explanation : The value stored in the CPU register can always be accessed faster than that stored in memory. But a register storage class variable will not necessarily be stored in a CPU register. It always depends upon the availability of registers.
int i = 4;
16.What is the output of this C code?

 int main()
   {
       int i = 7;
       i = i / 4;
       printf("%d \n", i);
       return 0;
   }
   

  1. Run Time Error
  2. 3
  3. 1
  4. Compile Time Error




Answer Answer : 3
Explanation : For 7/4, the quotient will be 1. And hence the output also is 1.


17.Which of the arithmetic operators takes only integers as both the inputs?
  1. +
  2. -
  3. *
  4. %
  5. /




Answer
Answer : 4
Explanation : The operator that takes only integers as both the inputs is "%".

18.What is the output of this C code?

void main()
   {
       int a =9.7 % 2;
       printf("Value of a is %d", a);
   }
   

  1. Value of a is 4
  2. Value of a is 4.53
  3. Compile Time Error
  4. Run Time Error




Answer
Answer : 4
Explanation : In the previous question itself, we saw that % takes both the inputs as integers. But in the current question, the first input is 9.7, which is not an integer and hence, the program will return a compile time error.

19.If the age of a person is given as the input to the computer, it should be able to make a decision on whether he or she is eligible to vote or not. What is the criteria for a person to vote?
  1. Age should be greater than 18.
  2. Should be married.
  3. All of the above




Answer
Answer : 1
Explanation : Now that we are sure about the criteria for voting, how do we instruct this to a computer? Here, the condition is “age > 18”. If that is true then we should print "You are eligible to vote". If the condition is false, then we should go to the end of the if-statement and execute the else-statement - print "You are not eligible to vote".


20.Amongst the following, choose the correct condition to check whether a given number is positive or not?
  1. The number should be divisible by 2
  2. The number should be greater than 0a




Answer
Answer : 2
Explanation : Any number greater than 0 is a positive number, otherwise it will be a negative number.


TCS PROGRAM LOGIC Level 1

TCS PROGRAM LOGIC



1. Find the error(s) in the following code, if any.

#include
int main()
{
printf(The Sun sets in the West)
return 0;
}

  1. In the print statement, the phrase The Sun sets in the West should be in double quotes.
  2. At the end of the print statement, there should be a semi colon.
  3. Both A and B
  4. No error

Answer : 3 Explanation : the phrase The Sun sets in the West, should be inside double quotes, and the statement should end with a semicolon.

2. Which is correct with respect to the size of the data types?
  1. int > char > float
  2. char > int > float
  3. char < int < double
  4. char < int < float


Answer
Answer
: 3 Explanation : Char has less bytes than int and int has less bytes than double in any system.

3.To get the exact size of a type or a variable on a particular platform, which of the following will you use?
  1. size(type)
  2. sizeof(type)
  3. variableSize(type)
Answer Answer : 2
Explanation :To get the exact size of a type or a variable on a particular platform, you can use the sizeof operator. The expressions sizeof(type) yields the storage size of the object or type in bytes.
Program

 #include 
   int main() { 
        printf("Storage size for float is: %d \n",sizeof(float));  
        return 0; 
     } 

4.Which of the following options has incorrect variable naming?
  1. int num1;
  2. int _firstAlpha;
  3. int 1st_number;
  4. int aero_pilot;
  5. Answer
Answer Answer : 3 Explanation :This is an incorrect naming of the variable, because as per the second rule, the first letter of a variable can only be an alphabet or an underscore.


int i = 4;
5.The above line of code is an example of:
  1. Variable Definition
  2. Variable Declara tion

Answer Answer : 1
Explanation : int i = 4 is an example of Variable Definition.

6.Predict the output:
#include  
  int main() 
{ 
  float c = 10.0; 
  printf ("Temperature in Fahrenheit is %.2f", (9/5)*c + 32); 
  return 0; 
} 

  1. Temperature in Fahrenheit is 50.00
  2. Temperature in Fahrenheit is 42.00
  3. Temperature in Fahrenheit is 0.00
  4. Compile Time Error

Answer
Answer : 2
Explanation : Since 9 and 5 are integers, integer arithmetic happens in subexpression (9/5) and we get 1 as its value. To fix the above program, we can use 9.0 instead of 9 or 5.0 instead of 5 so that floating point arithmetic happens.

7.What is the size of an int data type?
  1. 4 bytes
  2. 8 bytes
  3. Depends on the system/compiler
  4. Cannot be determined

Answer
Answer : 1
Explanation : in data type having 4 bytes

8.What is short int in C programming?
  1. Basic data type of C
  2. short is the qualifier and int is the basic data type
  3. qualifierr
  4. All of the above
Answer
Answer : 2
Explanation :

9.Which of the following is not a data type?
  1. Symbolic Data
  2. Alphanumeric Data
  3. Numeric Data
  4. Alphabetic Data

Answer
Answer : 4
Explanation : Numeric Data consists of only numbers. Alphabetic Data consists of only letters and a blank character and alphanumeric data consists of symbols. So, a symbolic data type not exists.

10.What are the entities whose values can be changed called?
  1. Constants
  2. Variables
  3. Modules
  4. Tokens

Answer
Answer : 2
Explanation :