Recommended For You

Friday, August 28, 2020

Capegemini Pseudo Codes - 28th August 2020 Batch

 

    28th August Batch Questions - Capgemini



                                    

                     






1.

Integer a1,p1
set a1=15
a1 = a1-1
a1 = a1 * 2 + 8
a1 = a1 / 2 + 9 * 5
p1 = a1 / 5 + 6
print p1
  1. 19
  2. 3
  3. 23
  4. 18
Ans- 4

2.

Integer a, b, c
set a=1, b=1
for (each c from 4 to 7)
    a= a - 1
    if(< 10)
        a= a -1
        continue
    End if
    a=a+2
End for 
Print b+a        
  1. 9
  2. 2
  3. -6
  4. 8
Ans- 3

3. 

Integer a, b, c
set a=13, b=9, c=6
    if(a<b)
        if(a<c)
          print a
        else
          print c
        end if 
    else if (b<c)
        print b
    else 
        print c
    end if                 
  1. 6 9
  2. 9
  3. 6
  4. 13
Ans- 4

4.

Integer number
set number = 1
do
    print number 
    number = number + 1
    print number + 1
while (number<=0)
end do while
print number                     
  1. 2 1 1
  2. 1 0 3
  3. 1 1 2
  4. 1 3 2
Ans- 4

5. 

Integer a, b, c
set a=3, b=1
for (each c from b to a)
    if (a+> 0)
        b=a
        continue
    End if
    a = a+b
    a = a-1 
End for
Print a       
  1. 2
  2. 1
  3. 3
  4. 8
Ans- 3





Thursday, August 27, 2020

Capegemini Pseudo Codes - 27th August 2020 Batch

    27th August Batch Questions - Capgemini



                                    

                     






1.

int i
set i =3
do
print i+3
i=i-1
while(not equals 0)
end while
  1. 6 6 6
  2. 6 5 6
  3. 5 5 5
  4. 6 5 4
Ans- 4

2.

int i , j , k , n
set j =1, k=1
for(each i from 1 to 5)
    print k
    j=j+1
    k=k+j
end for    
  1. 1 3 6 10 15
  2. 1 2 3 4 5
  3. 2 4 6 8 10
  4. 1 1 2 3 5
Ans- 1

3. a=2

Integer fun (Integer a)
    Integer x,y
    Set y=3
    for( each x from 0 to y-1)
        a=a+y
    End for
    
    Return a     
  1. 11
  2. 8
  3. 2
  4. 14
Ans- 1

4. a=2

Integer fun (Integer a) //a=2
    if(a>0)
        return a+ fun(a-1)
    Else
        return 0
    End if        
  1. 4
  2. 6
  3. 3
  4. 5
Ans- 3

5. 

Integer arr[] = {10, 20, 30, 40, 5}

Integer a,s

Set s=0

Set a = arr[1] + arr[2]

Print a  
  1. 25
  2. 5
  3. 50
  4. 40
Ans- 3


6. 
Integer a,b,c
Set b = 40, a = 20, c = 20

if ( c > (c+a) )
    b=0
Else
    a = a + 2
    c = a + 2
End if

Print a + b + c
  1. 25
  2. 5
  3. 50
  4. 40
Ans- 4





Monday, August 24, 2020

Pseudo Codes 3- Based On Format Specifiers and Variables Decleration

   



                                    

                     

















1. 
#include <stdio.h>
int main()
{
    char ch = 'A';
    printf("%d\n", ch);
    return 0;
}


  1. A
  2. 'A'
  3. 65
  4. 97
Ans- 3

2.
Which of the following is not a valid declaration in C ?

1.short int x;

2.signed short x;

3.short x;

4.unsigned short x;



  1. 3 and 4
  2. 1
  3. 2
  4. All are valid
Ans- 4



3.

#include <stdio.h>
int i;
int main()
{
    if (i)
        ;
    else
        printf("Ëlse");
    return 0;
}


  1. if block is executed.
  2. else block is executed
  3. It is unpredictable as i is not initialized.
  4. Error: misplaced else
Ans- 2

4.
void swap(int x, int y)
{
    int tmp;
    tmp = x;
    x = y;
    y = tmp;
}



  1. Call swap (a, b)
  2. Call swap (&a, &b)
  3. swap(a, b) cannot be used as it does not return any value
  4. swap(a, b) cannot be used as the parameters passed by value
Ans- 4


5.
What will be the output of the following code snippet?


#include <stdio.h>
int foo(int* a, int* b)
{
    int sum = *+ *b;
    *= *a;
    return *= sum - *b;
}
int main()
{
    int i = 0, j = 1, k = 2, l;
    l = i++ || foo(&j, &k);
    printf("%d %d %d %d", i, j, k, l);
    return 0;
}



  1. 1 2 1 1
  2. 1 1 2 1
  3. 1 2 2 1
  4. 1 2 2 2
Ans- 1

Tuesday, August 18, 2020

Free Coursera Financial Aid Answers


                                     

                                   




Coursera Answers


Question 1

 My name is {Coursera batija} from India.

 

I am a student, I do not earn money and belongs to a poor family, I am hardly affording my school fee. My father income is not sufficient, He has a large family to support, I can't even buy new books and clothes. I am completing my studies on Scholarship basis that is provided by my school.

 

Ii want to complete this specialization.I need this financial aid so that I can learn how to make applications from some reputed institute. I will be able to create some projects based on this course and support my family.

 

In today's Information technology world, It has a large market to work on. I also want to be a part of this market. But unfortunately, I have no money to achieve this precious opportunity,

 

Please help me and give me financial aid. I will be extremely grateful to you for this act of kindness.

 

Thank you.

 

 

 

 

 

 

Question 2

 

This course will definitely help me to achieve career goals. I need this financial aid so that I can learn how to make codes for some reputed institute. I will be able to create some projects based on this course and support my family.

 

In today's Information technology world, It has a large market to work on. I also want to be a part of this market. But unfortunately, I have no money to achieve this precious opportunity,

The people around me are learning these courses to secure their future I do not want to become the tail light follower. I also want to be the professional in this field. For this purpose whatever is needed, I will definitely do it. Here I have a financial aid opportunity, Please help me I really need this.  

 

Please help me and give me financial aid. I will be extremely grateful to you for this act of kindness.

 

Thank you.

 

 

 

 

 

 

Question 3

No, I am a student and belongs to a very poor family where I am hardy affording my college fee. I have no money to buy new books to learn. I do not earn money that's the reason I can not afford the low-interest loan. Please help me and give me financial aid. I am so ambitious to learn this course.  

Companies Pseudo Codes

  



                                    

                                   


1) What is the time complexity of searching for an element in a circular linked list?

a) O(n)

b) O(nlogn)

c) O(1)

d) None of the mentioned

Ans: Option A


2) In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is

a) log 2 n

b) n?2

c) log 2 n 1

d) n

Ans: Option D


3) Which of the following will give the best performance?

a) O(n)

b) O(n!)

c) O(n log n)

d) O(n^C)

Ans: Option A


4) How many times the following loop be executed?

{

ch = b;

while(ch >= a && ch <= z)

ch++;

}


a) 0

b) 25

c) 26

d) 1

Ans: B


5) Consider the following piece of code.What will be the space required for this code?

int sum(int A[], int n)

{

int sum = 0, i;

for(i = 0; i < n; i++)

sum = sum + A[i];

return sum;

}

// sizeof(int) = 2 bytes


a) 2n + 8

b) 2n + 4

c) 2n + 2

d) 2n

Ans: A


6) What will be the output of the following pseudo code?

For input a=8 & b=9.

Function(input a,input b)

If(a<b)

return function(b,a)

elseif(b!=0)

return (a+function(a,b-1))

else

return 0


a) 56

b) 88

c) 72

d) 65

Ans: C


7) What will be the output of the following pseudo code?

Input m=9,n=6

m=m+1

N=n-1

m=m+n

if (m>n)

print m

else

print n


a) 6

b) 5

c) 10

d) 15

Ans: D


8) What will be the value of s if n=127?

Read n

i=0,s=0

Function Sample(int n)

while(n>0)

r=n%l0

p=8^i

s=s+p*r

i++

n=n/10

End While

Return s;

End Function


a) 27

b) 187

c) 87

d) 120

Ans: Option C


9) What will be the output of the following pseudocode?

Integer n

for (n = 3; n != 0; n--)

Print n

n = n-1

end for


a) 3 1

b) 3 2 1

c) 3

d) Infinite Loop

Ans: Option D



11) What will be the value of even_counter if number = 2630?

Read number

Function divisible(number)

even_counter = 0, num_remainder = number;

while (num_remainder)

digit = num_remainder % 10;

if digit != 0 AND number % digit == 0

even_counter= even_counter+1

End If

num_remainder= num_remainder / 10;

End While

return even_counter;


a) 3

b) 4

c) 2

d) 1

Answer: Option D


12) What will be the value of t if a =56 ,b = 876?

Read a,b

Function mul(a, b)

t = 0

while (b != 0)

t = t + a

b=b-1

End While

return t;

End Function


a) 490563

b) 49056

c) 490561

d) None of the mentioned

Ans: Option B


13) Code to sort given array in ascending order:

Read size

Read a[1],a[2],a[size]

i=0

While(i<size)

j=i+1

While(j<size)

If a[i] < a[j] then

t= a[i];

a[i] = a[j];

a[j] = t;

End If

j=j+1

End While

i=i+1

End While

i=0

While (i<size)

print a[i]

i=i+1

End While


Find out the wrong statement in the above pseudocode


a) Line 4

b) Line 6

c) Line 7

d) No Error

Ans: Option C


14) What will be the output of the following pseudo code?

Input f=6,g=9 and set sum=0

Integer n

if(g>f)

for(n=f;n<g;n=n+1)

sum=sum+n

End for loop

else

print error message

print sum


a) 21

b) 15

c) 9

d) 6

Ans: A


15) Consider a hash table with 9 slots. The hash function is h(k) = k mod 9. The collisions are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respectively, are

a) 3, 0, and 1

b) 3, 3, and 3

c) 4, 0, and 1

d) 3, 0, and 2

Ans: A


16) You have an array of n elements. Suppose you implement a quick sort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is:

a) O(n2)

b) O(nLogn)

c) ?(nLogn)

d) O(n3)


Ans: A


17) Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time on Depth First Search of G? Assume that the graph is represented using adjacency matrix.


a)O(n)

b)O(m+n)

c)O(n2)

d)O(mn)

Ans: C


18) Let P be a Quick Sort Program to sort numbers in ascending order using the first element as a pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {1, 2, 3, 4, 5} and {4, 1, 5, 3, 2} respectively. Which one of the following holds?


a)t1 = 5

b)t1 < t2

c)t1 > t2

d)t1 = t2


Ans: C


19) What does the following piece of code do?

public void func(Tree root)

{

func(root.left());

func(root.right());

System.out.println(root.data());

}

a)Preorder traversal

b)Inorder traversal

c) Postorder traversal

d)Level order traversal


Ans: C



20) How will you find the minimum element in a binary search tree?

a) public void min(Tree root)

{

while(root.left() != null)

{

root = root.left();

}

System.out.println(root.data());

}


b) public void min(Tree root)

{

while(root != null)

{

root = root.left();

}

System.out.println(root.data());

}


c) public void min(Tree root)

{

while(root.right() != null)

{

root = root.right();

}

System.out.println(root.data());

}


d) public void min(Tree root)

{

while(root != null)

{

root = root.right();

}

System.out.println(root.data());

}


Ans: a