Questions

  1. GATE CS 2025 Set 1NAT2 marksEasy (estimate)

    GATE CS 2025 Set 1, Q.63

    Consider the following C program: #include <stdio.h> int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n>=t) t *= 10; t /=10; while (t>0) { d = n/t; n =...

    Data Types, Operators and Control Flow

  2. GATE CS 2025 Set 2NAT1 markEasy (estimate)

    GATE CS 2025 Set 2, Q.33

    int x=126,y=105; do { if(x>y) x=x-y; else y=y-x; } while(x!=y); printf("%d",x); The output of the given C code segment is ________. (Answer in integer)

    Data Types, Operators and Control Flow

  3. GATE CS 2024 Set 1MCQ1 markEasy (estimate)

    GATE CS 2024 Set 1, Q.18

    Consider the following C program: #include <stdio.h> int main(){ int a = 6; int b = 0; while(a < 10) { a = a / 12 + 1; a += b;} printf("%d", a); return 0;} Which one of the foll...

    Data Types, Operators and Control Flow

  4. GATE CS 2024 Set 1MSQ2 marksEasy (estimate)

    GATE CS 2024 Set 1, Q.48

    Consider the following C function definition. int f(int x, int y) { for (int i=0; i<y; i++) { x=x+x+y; } return x; } Which of the following statements is/are TRUE about the abov...

    Data Types, Operators and Control Flow

  5. GATE CS 2024 Set 2MCQ2 marksMedium (estimate)

    GATE CS 2024 Set 2, Q.42

    Consider an array X that contains n positive integers. A subarray of X is defined to be a sequence of array locations with consecutive indices. The C code snippet given be...

    Dynamic Programming · Data Types, Operators and Control Flow

  6. GATE CS 2022MCQ2 marksMedium (estimate)

    GATE CS 2022, Q.44

    What is printed by the following ANSI C program? #include<stdio.h> int main(int argc, char argv[]){ char a = 'P'; char b = 'x'; char c = (a & b) + ''; char d = (a | b) - '-';...

    Data Types, Operators and Control Flow

  7. GATE CS 2021 Set 1MCQ2 marksMedium (estimate)

    GATE CS 2021 Set 1, Q.47 (CS Q.37)

    Consider the following ANSI C program. #include <stdio.h> int main() { int i, j, count; count = 0; i = 0; for (j = -3; j <= 3; j++) { if ((j >= 0) && (i++)) count = count + j; }...

    Data Types, Operators and Control Flow

  8. GATE CS 2021 Set 1NAT2 marksEasy (estimate)

    GATE CS 2021 Set 1, Q.58 (CS Q.48)

    Consider the following ANSI C function: int SimpleFunction(int Y[], int n, int x) { int total = Y[0], loopIndex; for (loopIndex = 1; loopIndex <= n - 1; loopIndex++) total = x *...

    Data Types, Operators and Control Flow

  9. GATE CS 2019NAT2 marksEasy (estimate)

    GATE CS 2019, Q.62 (CS Q.52)

    Consider the following C program: #include <stdio.h> int main() { float sum = 0.0, j = 1.0, i = 2.0; while (i/j > 0.0625) { j = j + j; sum = sum + i/j; printf("%f\n", sum);...

    Data Types, Operators and Control Flow

  10. GATE CS 2017 Set 1NAT2 marksEasy (estimate)

    GATE CS 2017 Set 1, Q.53 (CS Q.53)

    Consider the following C program. #include <stdio.h> #include <string.h> void printlength(char *s, char *t) { unsigned int c = 0; int len = ((strlen(s) - strlen(t)) > c) ? strle...

    Data Types, Operators and Control Flow

  11. GATE CS 2017 Set 1NAT2 marksMedium (estimate)

    GATE CS 2017 Set 1, Q.55 (CS Q.55)

    The output of executing the following C program is ______. #include <stdio.h> int total(int v) { static int count = 0; while (v) { count += v & 1; v >>= 1; } return count; } voi...

    Functions, Recursion, Scope and Storage Classes · Data Types, Operators and Control Flow

  12. GATE CS 2017 Set 2MCQ2 marksMedium (estimate)

    GATE CS 2017 Set 2, Q.37 (CS Q.37)

    Consider the C program fragment below which is meant to divide by using repeated subtractions. The variables and are all unsigned int. while (r >= y...

    Data Types, Operators and Control Flow

  13. GATE CS 2017 Set 2NAT2 marksEasy (estimate)

    GATE CS 2017 Set 2, Q.54 (CS Q.54)

    Consider the following C program. #include <stdio.h> int main() { int m = 10; int n, n1; n = ++m; n1 = m++; n--; --n1; n -= n1; printf("%d", n); return 0; } The output...

    Data Types, Operators and Control Flow

  14. GATE CS 2016 Set 1NAT2 marksMedium (estimate)

    GATE CS 2016 Set 1, Q.55 (CS Q.45)

    The attributes of three arithmetic operators in some programming language are given below. Operator Precedence Associativity Arity + High Left Binary - Medium Right Binary * Low...

    Data Types, Operators and Control Flow

  15. GATE CS 2015 Set 1MCQ2 marksEasy (estimate)

    GATE CS 2015 Set 1, Q.43 (CS Q.33)

    Consider the following pseudo code, where and are positive integers: begin q := 0 r := x while r >= y do begin r := r - y q := q + 1 end end The post conditi...

    Data Types, Operators and Control Flow

  16. GATE CS 2015 Set 1NAT2 marksMedium (estimate)Not in current syllabus

    GATE CS 2015 Set 1, Q.52 (CS Q.42)

    Consider the following C program segment. while (first <= last) { if (array[middle] < search) first = middle + 1; else if (array[middle] == search) found = TRUE; else last = mid...

    Data Types, Operators and Control Flow

  17. GATE CS 2015 Set 3NAT2 marksMedium (estimate)

    GATE CS 2015 Set 3, Q.58 (CS Q.48)

    Consider the following C program: #include <stdio.h> int main() { int i, j, k = 0; j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5; k -= --j; for (i = 0; i < 5; i++) { switch (i + k) { cas...

    Data Types, Operators and Control Flow

  18. GATE CS 2014 Set 1MCQ2 marksMedium (estimate)

    GATE CS 2014 Set 1, Q.51 (CS Q.41)

    Consider the following C function in which size is the number of elements in the array E: int MyX(int *E, unsigned int size) { int Y = 0; int Z; int i, j, k; for(i = 0; i <...

    Data Types, Operators and Control Flow

  19. GATE CS 2014 Set 2NAT1 markEasy (estimate)

    GATE CS 2014 Set 2, Q.20 (CS Q.10)

    Consider the function func shown below: int func(int num) { int count = 0; while (num) { count++; num >>= 1; } return (count); } The value returned by func(435) is _____.

    Data Types, Operators and Control Flow

  20. GATE CS 2014 Set 2MCQ1 markMedium (estimate)

    GATE CS 2014 Set 2, Q.21 (CS Q.11)

    Suppose n and p are unsigned int variables in a C program. We wish to set p to nC3. If n is large, which one of the following statements is most likely to set p correctly?

    Data Types, Operators and Control Flow

  21. GATE CS 2013MCQ2 marksMedium (estimate)

    GATE CS 2013, Q.31 (CS Q.31)

    Consider the following function: int unknown(int n){ int i, j, k=0; for (i=n/2; i<=n; i++) for (j=2; j<=n; j=j*2) k = k + n/2; return (k); } The return value of the fun...

    Data Types, Operators and Control Flow

  22. GATE CS 2013MCQ2 marksMedium (estimate)Not in current syllabus

    GATE CS 2013, Q.50 (CS Q.50)

    The tester now tests the program on all input strings of length five consisting of characters 'a', 'b', 'c', 'd' and 'e' with duplicates allowed. If the tester carries out this...

    Data Types, Operators and Control Flow

  23. GATE CS 2013MCQ2 marksMedium (estimate)Not in current syllabus

    GATE CS 2013, Q.51 (CS Q.51)

    If array A is made to hold the string "abcde", which of the above four test cases will be successful in exposing the flaw in this procedure?

    Data Types, Operators and Control Flow

  24. GATE CS 2012MCQ1 markMedium (estimate)

    GATE CS 2012, Q.3 (CS Q.3)

    What will be the output of the following C program segment? char inChar = 'A' ; switch ( inChar ) { case 'A' : printf ("Choice A\ n") ; case 'B' : case 'C' : printf ("Choic...

    Data Types, Operators and Control Flow

  25. GATE CS 2011MCQ1 markEasy (estimate)Not in current syllabus

    GATE CS 2011, Q.10 (CS Q.10)

    Which one of the following is NOT desired in a good Software Requirement Specifications (SRS) document?

    Data Types, Operators and Control Flow

  26. GATE CS 2011MCQ2 marksMedium (estimate)Not in current syllabus

    GATE CS 2011, Q.47 (CS Q.47)

    The following is the comment written for a C function. /* This function computes the roots of a quadratic equation a.x^2 + b.x + c = 0. The function stores two real roots i...

    Data Types, Operators and Control Flow

Other topics of Programming in C