Post thumbnail
CAREER

Top 10 TCS Aspire Basic Programming Quiz Questions And Answers

Got a call letter from TCS? Then you might be looking for TCS Aspire Basic Programming Quiz Questions and Answers. Don’t you? Because Aspire is a mandatory learning program for all new recruits of IT and EIS.

TCS Aspire is an initial online interactive learning program. TCS Aspire is meant for everyone, especially for someone who is not from a programming background.

After four tedious years of Engineering, you might find the newly acquired workspace a bit overwhelming. So, through Aspire, you can brush up on your basic software engineering concepts and expand your soft skills.

Firstly, to unlock your Aspire, you should clear a simple quiz exam followed by two-course completions viz Introduction to Computer Systems and Basics of Programming.

So, Aspire will include courses on some chapters and then quizzes. After mastering those chapters, you will have quizzes for each chapter.

Once you have given all the chapter quizzes, the course completion quiz is there. Let’s look at some of the top TCS Aspire Basic Quiz Programming Questions and Answers.

Table of contents


  1. Some of the top TCS Aspire Basic Quiz Programming Questions and Answers
    • Q1. Given a string in Roman no format (s), your task is to convert it to an integer. Various symbols and their values are given below.
    • Code:
    • Q2. The longest sequence of consecutive one's after flipping a bit
    • Code:
    • Q3. Infinite Supply of Coins
    • Q4. The prime number using the square root
    • Q5. Read the following problem and code it:
    • Check one of the top-asked TCS Aspire Basic Programming Quiz Questions And Answers below
    • Q6. Implement two stacks using an array
    • Q7. Write a program to check whether the given parenthesis is balanced or not.
    • Q8. Write a program, to sum up all the elements in a tree.
    • Q9. Read the following TCS Aspire question
    • Q10. Read and code the answer
  2. To Conclude
    • Related Topics

Some of the top TCS Aspire Basic Quiz Programming Questions and Answers

Q1. Given a string in Roman no format (s), your task is to convert it to an integer. Various symbols and their values are given below.

I 1

V 5

X 10

L 50

C 100

D 500

M 1000

Continue on TCS Aspire basic programming quiz questions and answers!

Constraints: 1<=roman no range<=3999

Example 1:

Input: s = V

Output: 5

Example 2:

Input: s = III

Output: 3

Case 1

Case 2

Input (stdin): V

Output (stdout): 5

Input (stdin): X

Output (stdout): 10

Code:

import java.util.*;

import java.io.*;

class Main{

static int value(char r)

{

     if (r == ‘I’)

         return 1;

     if (r == ‘V’)

         return 5;

     if (r == ‘X’)

         return 10;

     if (r == ‘L’)

         return 50;

     if (r == ‘C’)

         return 100;

     if (r == ‘D’)

         return 500;

     if (r == ‘M’)

         return 1000;

     return -1;

}

Continue on TCS Aspire basic programming quiz questions and answers!

public static void getNumber(String s){

     int res=0;

     for(int i=0;i<s.length();i++){

         int  s1= value(s.charAt(i));

         if(i+1<s.length()){

             int  s2=value(s.charAt(i+1));

             if(s1>=s2){

                 res+=s1;

             }

             else {

                 res=res+s2-s1;

                 i++;

                 }

         }

         else {

             res+=s1;

             i++;

         }

     }

     System.out.println(res);

}

public static void main(String [] args){

     Scanner sc= new Scanner(System.in);

         String s=sc.next();

         Main.getNumber(s);

}

}

MDN

Q2. The longest sequence of consecutive one’s after flipping a bit

Given an integer ‘n’ and you are allowed to flip exactly one bit. Write a function to find the length of the longest sequence of consecutive 1’s you can create. Consider the size of the integer to 32 bits.

For example: Consider n=1775, its binary representation is 11011101111. After flipping the highlighted bit, we get consecutive 8 bits (of 1’s) that is 11011111111.

Hence the output is 8. Consider n=15, its binary representation is 01111. After flipping the highlighted bit, we get consecutive 5 bits (of 1’s) i.e., 11111. Hence the output is 5. Function Specification:- Give definition to: int flipBit(unsigned int n);

Format:

Input: Input is being fetched from the command line arguments. The only argument is an integer n.

Output: The output will be the length of the longest subsequence of consecutive 1’s.

Example:

Input: 1775

Output: 8

Case 1

Input (stdin): 1775

Output (stdout): 8

Continue on TCS Aspire basic programming quiz questions and answers!

Code:

import java.util.Scanner;

class Main

{

  static int max(int a, int b)

  {

if (a > b)

   return a;

return b;

  }

  static int longestSequence(int n)

  {

  if(~n==0)

    return 32;

int curLen=0,prevLen=0,maxLen=0;

Continue on TCS Aspire basic programming quiz questions and answers!

while(n!=0)

{

       if((n&1)==1)

         curLen++;

       else

       {

           prevLen=(n & 2)==0?0:curLen;

           curLen=0;

       }

       maxLen=max(curLen+prevLen,maxLen);

    n=n>>1;

}

return maxLen+1;

  }

  public static void main(String args[])

  {

Scanner sc = new Scanner(System.in);

int n = sc.nextInt();

      System.out.println(longestSequence(n));

  }

}

Q3. Infinite Supply of Coins

Given a value N, find the number of ways to make a change for N cents. If we have an infinite supply of each S = {S1, S2,.., Sm} valued coins. The order of coins doesn’t matter.

Constraints:

S <= 10

N <= 10

Example:

Input:

3

1 2 3

4

Output: 4

Explanation:

N = 4 and S = {1,2,3}, there are four solutions: {1,1,1,1}, {1,1,2}, {2,2}, {1,3}.

So the output should be 4.

Case 1

Case 2

Input (stdin)

3

1 2 3

4

Output (stdout): 4

Input (stdin)

4

2 5 3 6

10

Output (stdout): 5

Code:

import java.lang.*;

import java.io.*;

class Main

 {

    public static void main (String[] args) throws Exception{

     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

     StringBuilder op = new StringBuilder();

         int l = Integer.parseInt(br.readLine());

         int coin[] = new int[l];

         String[] s = br.readLine().split(” “);

         for(int i=0; i<l; i++)coin[i] = Integer.parseInt(s[i]);

         int N = Integer.parseInt(br.readLine());

         int[][] dp = new int[l+1][N+1];

         for(int i=0; i<=l; i++)dp[i][0]=1;

         for(int i=1; i<=l; i++){

             for(int j=1; j<=N; j++){

                 if(coin[i-1] <= j){

                     dp[i][j] = dp[i-1][j]+dp[i][j-coin[i-1]];

                 }else{

                     dp[i][j]=dp[i-1][j];

                 }

             }

         }

         op.append(dp[l][N]);

     System.out.println(op);

     }

}

Q4. The prime number using the square root

Given a positive integer N, check if the number is prime or not.

Constraint: 1 < N < 106

Example 1:

Input: 11

Output: The given number is a prime number.

Example 2:

Input: 15

Output: Given number is not a prime number

Case 1

Case 2

Input (stdin): 11

Output (stdout): The given number is a prime number

Code:

import java.util.*;

class Main {

    public static void main (String[] args) {

     Scanner sc=new Scanner(System.in);

     int n;

     n=sc.nextInt();

     int flag=1;

     for(int i=2;i*i<=n;i++)

     {

         if(n%i==0)

         {

             flag=0;

             break;

         }

     }

     if(flag==1)

         System.out.println(“Given number is a prime number”);

     else

         System.out.println(“Given number is not a prime number”);

    }

}

TCS Aspire basic programming quiz questions and answers

Q5. Read the following problem and code it:

Check one of the top-asked TCS Aspire Basic Programming Quiz Questions And Answers below

Azad’s mother gave him Rs 100, so he decided to buy some chocolates. He went to a shop that only has chocolates of Rs 3 and 7, so it now depends on Azad’s mood on how many chocolates he will buy.

Maybe he will not buy single chocolate. Can you tell whether he has visited the same shop, from the remaining amount? If N (0 ≤ N ≤ 100) is equal to the possible remaining amount he has after he came from that shop, then print 1 or else 0.

Format:

Input: The first line of the input contains a single integer T denoting the number of test cases. The first line of each test case contains N, denoting the remaining amount.

Output: For each test case, the output is 0 or 1.

Constraints:

1 ≤ T ≤ 101

0 ≤ N ≤ 100

Continue on TCS Aspire basic programming quiz questions and answers!

Example:

Input:

4

93

97

94

99

Output:

1

1

1

0

Explanation:

100 – (0 * 3 + 1 * 7) = 93, so the output is 1.

100 – (1 * 3 + 0 * 7) = 97, so the output is 1.

100 – (2 * 3 + 0 * 7) = 96, so the output is 1.

It is not possible, so the output is 0.

Case 1

Case 2

Input (stdin)

4

93

97

94

99

Output (stdout)

1

1

1

0

Input (stdin)

3

99

55

26

Output (stdout)

0

1

1

Code:

import java.util.*;

class Main {

    public static void main (String[] args) {

    Scanner sc=new Scanner(System.in);

    int t=sc.nextInt();

    while(t– > 0){

    int n=sc.nextInt();

    boolean sieve[]=new boolean[101];

    for(int i=0;i<101;i++){

        sieve[i]=false;

    }

         sieve[100]=true;

         for (int i = 99; i >= 0; i–) {

             if (i+3 <= 100 && sieve[i+3]) {

                 sieve[i] = true;

             }

             else if (i+7 <= 100 && sieve[i+7]) {

                 sieve[i] = true;

             }

         }

         System.out.println(sieve[n]?1:0);

    }

    }

}

Q6. Implement two stacks using an array

Write a program to implement the two stacks using one array. Consider the size of an array as 1000.

Code:

import java.util.Scanner;

public class Main {

  public static void main(String args[]) {

    Scanner sc = new Scanner(System.in);

    TwoStacks st = new TwoStacks(1000);

    int size1 = sc.nextInt();

    for (int i = 0; i < size1; i++)

    st.push1(sc.nextInt());

    int size2 = sc.nextInt();

    for (int i = 0; i < size2; i++)

    st.push2(sc.nextInt());

    System.out.println(“Stack 1 Elements: “);

    st.print1();

    System.out.println(“Stack 2 Elements: “);

    st.print2();

    int deleteFirst = sc.nextInt();

    while (deleteFirst– > 0)

    st.pop1();

    System.out.println(“Stack 1 Elements: “);

    st.print1();

    int deleteSecond = sc.nextInt();

    while (deleteSecond– > 0)

    st.pop2();

    System.out.println(“Stack 2 Elements: “);

    st.print2();

    sc.close();

    }

    static class TwoStacks {

    int size;

    int top1, top2;

    int arr[];

    TwoStacks(int n) {

    arr = new int[n];

    size = n;

    top1 = -1;

    top2 = size;

    }

    void push1(int x) {

    if (top1 < top2 – 1) {

    top1++;

    arr[top1] = x;

    }

    else

    System.out.println(“Stack Overflow”);

    }

    void push2(int x) {

    if (top1 < top2 – 1) {

    top2–;

    arr[top2] = x;

    }

    else

    System.out.println(“Stack Overflow”);

    }

    int pop1() {

    if (top1 >= 0) {

    int x = arr[top1];

    top1–;

    return x;

    }

    else

    System.out.println(“Stack underflow. pop from stack 1 failed”);

    return 0;

    }

    int pop2() {

    if (top2 < size) {

    int x = arr[top2];

    top2++;

    return x;

    }

    else

    System.out.println(“Stack Underflow”);

    return 0;

    }

    void print1() {

    int temp = top1;

    while (temp >= 0) {

    System.out.print(arr[temp] + ” “);

    temp–;

    }

    System.out.println();

    }

    void print2() {

    int temp = top2;

    while (temp < size) {

    System.out.print(arr[temp] + ” “);

    temp++;

    }

    System.out.println();

    }

    }

}

Q7. Write a program to check whether the given parenthesis is balanced or not.

Code:

import java.util.*;

public class Main {

public static boolean areBracketsBalanced(String expr) {

     Stack<Character> stack= new Stack<>();

     for (int i = 0; i < expr.length(); i++)

     {

         char x = expr.charAt(i);

         if (x == ‘(‘ || x == ‘[‘ || x == ‘{‘)

         {

             stack.push(x);

             continue;

         }

         if (stack.isEmpty())

             return false;

         char check;

         switch (x) {

         case ‘)’:

             check = stack.pop();

             if (check == ‘{‘ || check == ‘[‘)

                 return false;

             break;

         case ‘}’:

             check = stack.pop();

             if (check == ‘(‘ || check == ‘[‘)

                 return false;

             break;

         case ‘]’:

             check = stack.pop();

             if (check == ‘(‘ || check == ‘{‘)

                 return false;

             break;

         }

     }

     return stack.isEmpty();

}

public static void main(String[] args)

{

     Scanner s=new Scanner(System.in);

     String expr = s.next();

     if (areBracketsBalanced(expr))

         System. out.println(“Balanced “);

     else

         System.out.println(“Not Balanced “);

}

}

Q8. Write a program, to sum up all the elements in a tree.

Example:

Input:

6

3

1

4

2

-1

Output: The Sum of all nodes are 16

Case 1

Case 2

Input (stdin)

6

3

1

4

2

-1

Output (stdout): The Sum of all nodes is 16

Input (stdin)

1

2

3

4

5

-1

Output (stdout): The Sum of all nodes is 15

Q9. Read the following TCS Aspire question

Now terrace Gardens transferring from manual to automated systems to provide services efficiently to a corporate company. At this stage, the terrace gardens looking for a console application. First, let’s concentrate on the registration part. When a new Guest/Customer comes to book a room we need to record the details.

Create a Class called Customer and get the following details from the user: Name Address Contact Email update Proof type Proof id Create Appropriate Getters and Setters in the customer class and member functions: void Register(String name, String address, String contactNumber, String email, String proofType, String proofID) Generate an id for the Guest /Customer and give it to him. Print all the details given by the customer.

Create a class Main with data members, get input in the Main class, and pass it to the customer class using setters. String name (consists of only alphabets, No special Characters allowed) String address (can contain alphanumeric characters and Hyphen (-) symbol ) String contactNumber (can contain only numbers) String email(should contain @ symbol) String proofType(contains only alphabets) String proofID(can consists of alphanumeric characters alone) Print Registration successful or Failed. If Successful print details otherwise print the reason like “Invalid Name”

Sample Input/Output 1:

Enter the number

1

Enter the name

Vijay

Enter the address

Chennai

Enter the contact number

9876543210

Enter the email

[email protected]

Enter the ProofType

id

Enter the proof ID

998877665544

RegistrationSuccessfull

Your Details:

Vijay

Chennai

9876543210

[email protected]

998877665544

Your id is 1

Sample Input/Output 2:

TCS Aspire basic programming quiz questions and answers;

Enter the number Customer

2

Enter the name

Vijay1

Enter the address

Chennai

Enter the contact number

9876543210

Enter the email

[email protected]

Enter the ProofType

id

Enter the proof ID

998877665544

Invalid Name

Registration Failed

Enter the name

Vijay

Enter the address

Chennai

Enter the contact number

Contact

Enter the email

[email protected]

Enter the ProofType

id

Enter the proof ID

998877665544

Invalid Contact Number

Registration Failed

Case 1

Input (stdin)

1

Vijay

Chennai

Continue on TCS Aspire basic programming quiz questions and answers!

9876543210

[email protected]

aadhar

998877665544

Output (stdout)

Enter the number of Customers

Enter the name

Enter the address

Enter the contact number

Enter the email

Enter the ProofType

Enter the proof ID

Registration Successfull

Your Details:

Vijay

Chennai

9876543210

[email protected]

aadhar

998877665544

Your id is 1

import java.util.*;

class Customer

{

String name;

String address;

String contactNumber;

String email;

String proofType;

String proofID;

int ncount=0,x=1;

void Register(String name,String address,String contactNumber,String

email, String proofType, String proofID)

{

int i,ncheck=0,adcheck=0,check=0,echeck=0,ptcheck=0,pidcheck=0;

for(i=0;i<name.length();i++)

{

if(Character.isLetter(name.charAt(i)))

ncheck++;

}

for(i=0;i<address.length();i++)

{

if((Character.isLetter(address.charAt(i)))||(Character.isDigit(address.charAt(i)))||(address.charAt(i)==’-‘))

adcheck++;

}

for(i=0;i<contactNumber.length();i++)

{

if(Character.isDigit(contactNumber.charAt(i)))

check++;

}

for(i=0;i<email.length();i++)

{

if((email.charAt(i)==’@’)||(email.charAt(i)==’.’))

echeck++;

}

for(i=0;i<proofType.length();i++)

{

if(Character.isLetter(proofType.charAt(i)))

ptcheck++;

}

for(i=0;i<proofID.length();i++)

{

if((Character.isLetter(proofID.charAt(i)))||(Character.isDigit(proofID.charAt(i))))

pidcheck++;

}

if(ncheck!=name.length())

System.out.println(“Invalid Name\nRegistration Failed”);

else if(adcheck!=address.length())

System.out.println(“Invalid Address\nRegistration Failed”);

else if(check!=contactNumber.length())

Continue on TCS Aspire basic programming quiz questions and answers!

System.out.println(“Invalid Contact Number\nRegistration Failed”);

else if(echeck!=2)

System.out.println(“Invalid Email\nRegistration Failed”);

else if(ptcheck!=proofType.length())

System.out.println(“Invalid ProofType\nRegistration Failed”);

else if(pidcheck!=proofID.length())

System.out.println(“Invalid ProofId\nRegistration Failed”);

else{

System.out.println(“Registration Successfull\nYour Details:\n”+name+”\n”+address+”\n”+contactNumber+”\n”+email+”\n”+proofType+”\n”+proofID+”\nYour id is “+x);

x++;

}

}

}

class Main extends Customer{

public static void main (String[] args) {

Scanner s=new Scanner(System.in);

Main ob=new Main();

System.out.println(“Enter the number of Customers”);

int x=s.nextInt();

int k=0;

while(k<x){

System.out.println(“Enter the name”);

ob.name=s.next();

System.out.println(“Enter the address”);

ob.address=s.next();

Continue on TCS Aspire basic programming quiz questions and answers!

System.out.println(“Enter the contact number”);

ob.contactNumber=s.next();

System.out.println(“Enter the email”);

ob.email=s.next();

System.out.println(“Enter the ProofType”);

ob.proofType=s.next();

System.out.println(“Enter the proof ID”);

ob.proofID=s.next();

ob.Register(ob.name,ob.address,ob.contactNumber,ob.email,ob.proofType,ob.proofID);

k++;

}

}

}

Q10. Read and code the answer

Implement the inheritance concept. Create four classes namely Main, Bike, Sportbike and Scooter. Here Main class contains String name; String colour; Float cc; Integer speed; Double price; Integer manufacturerDiscount; Integer weight; public Bike(String name, String colour, Float cc, Integer speed, Double price) { this.name = name; this.color = color; this.cc = cc; this.speed = speed; this.price = price; } Bike class contains: private String color; private String name; private Float cc; private Integer speed; private Double price;

Here Bike is the base class and SportBike, the scooter is the subclass. public class SportBike extends Bike { public SportBike(String name, String colour, Float cc, Integer speed, Double price, Integer manufacturerDiscount) {} } public class Scooter extends Bike { public Scooter(String name, String colour, Float cc, Integer speed, Double price, Integer weight) {} } Use the super reference to do the things already done by the superclass.

Sample Input and Output 1:

Name of the bike:

Ducati

Colour of the bike:

Red

Capacity(CC) of the bike:

400

Speed of the bike:

550

Price of the bike:

100000

Discount on the bike:

9500

Enter the details of the Scooter

Name of the Scooter:

Bajaj

Colour of the Scooter:

Grey

Capacity(CC) of the Scooter:

110

Speed of the Scooter:

120

Price of the Scooter:

Discount on the scooter:

4500

45000

Weight of the scooter:

250

Sports Bike:

Name: Ducati

Colour: Red

Capacity: 400.0

Speed: 550

Price: 100000.0

Manufacturer Discount: 9500

Sports Bike price is 90500.0

Scooter :

Name: Bajaj

Colour: Grey

Capacity: 110.0

Speed: 120

Price: 45000.0

Weight: 250

Manufacturer Discount: 4500

The scooter price is 40500.0

Enter the details of the Sports Bike

Case 1

Input (stdin)

Ducati

Red

400

550

100000

9500

Bajaj

Grey

110

120

45000

4500

250

Output (stdout)

Enter the details of the Sports Bike

Name of the bike:

Colour of the bike :

Capacity(cc) of the bike:

Speed of the bike:

Price of the bike:

Discount on the bike:

Enter the details of the Scooter

Name of the Scooter

Colour of the Scooter :

Capacity(CC) of the Scooter :

Speed of the Scooter :

Price of the Scooter :

Discount on the scooter :

Weight of the scooter :

Sports Bike :

Name: Ducati

Colour: Red

Capacity: 400.0

Speed: 550

Price: 100000.0

Manufacturer Discount: 9500

Sports Bike price is 90500.0

Scooter:

Continue on TCS Aspire basic programming quiz questions and answers!

Name: Bajaj

Colour: Grey

Capacity: 110.0

Speed: 120

Price: 45000.0

Weight: 250

Manufacturer Discount: 4500

The scooter price is 40500.0

import java.util.Scanner;

class Bike{

private String colour;

private String name;

private Float cc;

private Integer speed;

private Double price;

private int weight;

//GETTERS

public String getName(){

     return name;

}

public String getColor(){

     return colour;

}

public float getCC(){

     return cc;

}

public int getSpeed(){

     return speed;

}

public Double getPrice(){

     return price;

}

public int getWeight(){

     return weight;

}

//SETTER

public void setName(String name){

     this.name=name;

}

public void setColor(String color){

     this.color=color;

}

public void setCC(float cc){

     this.cc=cc;

}

public void setSpeed(int speed){

     this.speed=speed;

}

public void setPrice(Double price){

     this.price=price;

}

public void setWeight(int weight){

     this.weight=weight;

}

}

class Sportbike extends Bike{

private int discount;

private double price1;

public Sportbike(String name, String colour, Float cc, Integer speed, Double price, int discount){

     super.setName(name);

     super.setColor(color);

     super.setCC(cc);

     this.price1=price;

     this.discount=discount;

     super.setSpeed(speed);

Continue on TCS Aspire basic programming quiz questions and answers!

     super.setPrice(price-discount);

}

public int getDiscount(){

     return discount;

}

public double getPrice1(){

     return price1;

}

public String toString()

{

     return “Name : “+super.getName()+”\nColor : “+super.getColor()+”\nCapacity : “+super.getCC()+”\nSpeed : “+super.getSpeed()+”\nPrice : “+getPrice1()+”\nManufacturer Discount : “+getDiscount()+”\nSports Bike price is “+super.getPrice();

}

}

class Scooter extends Bike{

private int discount;

private double price1;

private int weight;

public Scooter(String name, String colour, Float cc, Integer speed, Double price, Integer weight, int discount) {

     super.setName(name);

     super.setColor(color);

     super.setCC(cc);

     super.setSpeed(speed);

     this.price1=price;

     this.discount=discount;

     this.weight=weight;

     super.setPrice(price-discount);

     super.setWeight(weight);

}

public int getDiscount(){

     return discount;

}

public double getPrice1(){

     return price1;

}

public int getWeight(){

     return weight;

}

public String toString()

{

     return “Name : “+super.getName()+”\nColor : “+super.getColor()+”\nCapacity : “+super.getCC()+”\nSpeed : “+super.getSpeed()+”\nPrice : “+getPrice1()+”\nWeight : “+getWeight()+”\nManufacturer Discount : “+getDiscount()+”\nScooter price is “+super.getPrice();

}

}

class Main{

public static void main(String args[]){

     String name;

     String colour;

     float cc;

     int speed;

     double price;

     int manufacturerDiscount;

     int weight;

     //

     System.out.println(“Enter the details of Sports Bike”);

     Scanner scan=new Scanner(System.in);

     System.out.println(“Name of the bike:”);

     name=scan.next();

     System.out.println(“Color of the bike:”);

     color=scan.next();

     System.out.println(“Capacity(cc) of the bike:”);

     cc=scan.nextFloat();

     System.out.println(“Speed of the bike:”);

Continue on TCS Aspire basic programming quiz questions and answers!

     speed=scan.nextInt();

     System.out.println(“Price of the bike:”);

     price=scan.nextDouble();

     System.out.println(“Discount of the bike:”);

     manufacturerDiscount=scan.nextInt();

     Sportbike qwert=new Sportbike(name,color,cc,speed,price,manufacturerDiscount);

     //

     System.out.println(“Enter the details of Scooter”);

     System.out.println(“Name of the Scooter”);

     name=scan.next();

     System.out.println(“Color of the Scooter:”);

     color=scan.next();

     System.out.println(“Capacity(CC) of the Scooter:”);

     cc=scan.nextFloat();

     System.out.println(“Speed of the Scooter:”);

     speed=scan.nextInt();

     System.out.println(“Price of the Scooter:”);

     price=scan.nextDouble();

     System.out.println(“Discount of the scooter:”);

     manufacturerDiscount=scan.nextInt();

     System.out.println(“Weight of the scooter:”);

     weight=scan.nextInt();

     Scooter yuio =new Scooter(name,color,cc,speed,price,weight,manufacturerDiscount);

     System.out.println(“Sports Bike :”);

     System.out.println(qwert.toString());

     System.out.println(“Scooter :”);

     System.out.println(yuio.toString());

}

}

Looking for TCS Xplore Python Coding questions: Top 9 TCS Xplore Python Coding Questions [DeCode with GUVI]

To Conclude

We know, this series of important questions on TCS Aspire and TCS Xplore is getting interesting and you crave more programs like these. Don’t you? Check our CODEKATA & WEBKATA platforms for more interesting practice programs.

Have a query? Drop your queries, suggestions, and thoughts in the comment section below! Keep Learning!

MDN

Top 100 Important Amazon Data Scientist Interview Questions

Top Postman Interview Questions

Top 5 CRED Interview Questions

Career transition

Did you enjoy this article?

Schedule 1:1 free counselling

Similar Articles

Share logo Whatsapp logo X logo LinkedIn logo Facebook logo Copy link
Free Webinar
Free Webinar Icon
Free Webinar
Get the latest notifications! 🔔
close
Table of contents Table of contents
Table of contents Articles
Close button

  1. Some of the top TCS Aspire Basic Quiz Programming Questions and Answers
    • Q1. Given a string in Roman no format (s), your task is to convert it to an integer. Various symbols and their values are given below.
    • Code:
    • Q2. The longest sequence of consecutive one's after flipping a bit
    • Code:
    • Q3. Infinite Supply of Coins
    • Q4. The prime number using the square root
    • Q5. Read the following problem and code it:
    • Check one of the top-asked TCS Aspire Basic Programming Quiz Questions And Answers below
    • Q6. Implement two stacks using an array
    • Q7. Write a program to check whether the given parenthesis is balanced or not.
    • Q8. Write a program, to sum up all the elements in a tree.
    • Q9. Read the following TCS Aspire question
    • Q10. Read and code the answer
  2. To Conclude
    • Related Topics